Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753066AbbKPRkc (ORCPT ); Mon, 16 Nov 2015 12:40:32 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:37525 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752710AbbKPRk3 (ORCPT ); Mon, 16 Nov 2015 12:40:29 -0500 Date: Mon, 16 Nov 2015 18:40:26 +0100 From: Pavel Machek To: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, misael.lopez@ti.com, jsarha@ti.com, peter.ujfalusi@ti.com, tiwai@suse.com, perex@perex.cz, broonie@kernel.org, lgirdwood@gmail.com Subject: [PATCH] sound/soc/davinci: fix error case in mcasp_set_ctl_reg Message-ID: <20151116174026.GA1735@amd> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1483 Lines: 41 This fixes typo in comment and fixes mcasp_set_ctl_reg to actually printk on error as author wanted, and cleans it up. Yes, i will end up being 1001 in the old code. Signed-off-by: Pavel Machek diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index b960e62..a739ca8 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -148,15 +150,14 @@ static void mcasp_set_ctl_reg(struct davinci_mcasp *mcasp, u32 ctl_reg, u32 val) mcasp_set_bits(mcasp, ctl_reg, val); - /* programming GBLCTL needs to read back from GBLCTL and verfiy */ + /* programming GBLCTL needs to read back from GBLCTL and verify */ /* loop count is to avoid the lock-up */ - for (i = 0; i < 1000; i++) { + for (i = 0; i <= 1000; i++) { if ((mcasp_get_reg(mcasp, ctl_reg) & val) == val) - break; + return; } - if (i == 1000 && ((mcasp_get_reg(mcasp, ctl_reg) & val) != val)) - printk(KERN_ERR "GBLCTL write error\n"); + printk(KERN_ERR "GBLCTL write error\n"); } static bool mcasp_is_synchronous(struct davinci_mcasp *mcasp) -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/