mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
ebf1b764aa
commit
644a9d3b66
1 changed files with 1 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue