]> Git Repo - linux.git/commitdiff
Input: adp5588-keys - fix check on return code
authorNuno Sa <[email protected]>
Fri, 20 Sep 2024 07:22:52 +0000 (09:22 +0200)
committerDmitry Torokhov <[email protected]>
Fri, 20 Sep 2024 08:21:56 +0000 (01:21 -0700)
During adp5588_setup(), we read all the events to clear the event FIFO.
However, adp5588_read() just calls i2c_smbus_read_byte_data() which
returns the byte read in case everything goes well. Hence, we need to
explicitly check for a negative error code instead of checking for
something different than 0.

Fixes: e960309ce318 ("Input: adp5588-keys - bail out on returned error")
Cc: [email protected]
Signed-off-by: Nuno Sa <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>
drivers/input/keyboard/adp5588-keys.c

index 1b0279393df4bbd3bce4399b0b35279c3fdec3f6..5acaffb7f6e11d9a44b8c463a10291cfa23eb60f 100644 (file)
@@ -627,7 +627,7 @@ static int adp5588_setup(struct adp5588_kpad *kpad)
 
        for (i = 0; i < KEYP_MAX_EVENT; i++) {
                ret = adp5588_read(client, KEY_EVENTA);
-               if (ret)
+               if (ret < 0)
                        return ret;
        }
 
This page took 0.059682 seconds and 4 git commands to generate.