IRDA: cnt is off by 1

Submitted by roel kluin on Feb. 11, 2009, 9:22 p.m.

Details

Message ID 4993418D.5020700@gmail.com
State Accepted
Delegated to: David Miller
Headers show

Commit Message

roel kluin Feb. 11, 2009, 9:22 p.m.
Jarek Poplawski wrote:

> Roel, please resend once more, but separated: something could go to
> stable, but not necessarily together. 

Ok, Here's for irda:

------------------------------>8----------------8<------------------------------
If no prior break occurs, cnt reaches 101 after the loop, so we are still able
to change speed when cnt has become 100.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller Feb. 13, 2009, 12:42 a.m.
From: Roel Kluin <roel.kluin@gmail.com>
Date: Wed, 11 Feb 2009 22:22:21 +0100

> If no prior break occurs, cnt reaches 101 after the loop, so we are still able
> to change speed when cnt has become 100.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>

Applied, thanks Roel.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch hide | download patch | download mbox

diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c
index 7eafdca..85e88da 100644
--- a/drivers/net/irda/mcs7780.c
+++ b/drivers/net/irda/mcs7780.c
@@ -585,7 +585,7 @@  static int mcs_speed_change(struct mcs_cb *mcs)
 		mcs_get_reg(mcs, MCS_RESV_REG, &rval);
 	} while(cnt++ < 100 && (rval & MCS_IRINTX));
 
-	if(cnt >= 100) {
+	if (cnt > 100) {
 		IRDA_ERROR("unable to change speed\n");
 		ret = -EIO;
 		goto error;