[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1353057470.4277.5.camel@phoenix>
Date: Fri, 16 Nov 2012 17:17:50 +0800
From: Axel Lin <axel.lin@...ics.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Anantha Narayanan <anantha.narayanan@...el.com>,
Alan Cox <alan@...ux.intel.com>, Arnd Bergmann <arnd@...db.de>,
linux-kernel@...r.kernel.org
Subject: [PATCH RESEND] misc: apds9802als: Fix the logic checking timeout in
als_wait_for_data_ready()
In the case of timeout waiting for data ready, the retry variable is -1.
This also fixes a bug: current code returns -ETIMEDOUT if latest retry success
( which means retry is 0 when exiting the while loop ).
Signed-off-by: Axel Lin <axel.lin@...ics.com>
---
Resend to Greg's correct email address.
drivers/misc/apds9802als.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/apds9802als.c b/drivers/misc/apds9802als.c
index 0314773..94923d2 100644
--- a/drivers/misc/apds9802als.c
+++ b/drivers/misc/apds9802als.c
@@ -68,7 +68,7 @@ static int als_wait_for_data_ready(struct device *dev)
ret = i2c_smbus_read_byte_data(client, 0x86);
} while (!(ret & 0x80) && retry--);
- if (!retry) {
+ if (retry < 0) {
dev_warn(dev, "timeout waiting for data ready\n");
return -ETIMEDOUT;
}
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists