misc: apds9802als: Fix checking timeout in als_wait_for_data_ready()
PATCH 1/1 misc: apds9802als: Fix 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 <[email protected]>
--- drivers/misc/apds9802als.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/apds9802als.c +1 -1
@@ -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 ; }
Signature · 1 line
1.7.9.5