alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
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
Date: Mon, 16 Nov 2015 18:40:26 +0100	[thread overview]
Message-ID: <20151116174026.GA1735@amd> (raw)


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 <pavel@denx.de>

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

             reply	other threads:[~2015-11-16 17:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-16 17:40 Pavel Machek [this message]
2015-11-17  7:40 ` [PATCH] sound/soc/davinci: fix error case in mcasp_set_ctl_reg Peter Ujfalusi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151116174026.GA1735@amd \
    --to=pavel@ucw.cz \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jsarha@ti.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=misael.lopez@ti.com \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@ti.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).