From patchwork Mon Nov 16 17:40:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 7629421 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E6D859F2EC for ; Mon, 16 Nov 2015 17:41:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1415120513 for ; Mon, 16 Nov 2015 17:41:08 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 74EAD204FB for ; Mon, 16 Nov 2015 17:41:05 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 28FC226051D; Mon, 16 Nov 2015 18:41:04 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 05EF92604D3; Mon, 16 Nov 2015 18:40:56 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9E5F12604DF; Mon, 16 Nov 2015 18:40:54 +0100 (CET) Received: from atrey.karlin.mff.cuni.cz (atrey.karlin.mff.cuni.cz [195.113.26.193]) by alsa0.perex.cz (Postfix) with ESMTP id 383472604A4 for ; Mon, 16 Nov 2015 18:40:49 +0100 (CET) Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 8D78F82281; Mon, 16 Nov 2015 18:40:27 +0100 (CET) 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 Message-ID: <20151116174026.GA1735@amd> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Subject: [alsa-devel] [PATCH] sound/soc/davinci: fix error case in mcasp_set_ctl_reg X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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)