diff mbox series

Input: adp5588-keys: fix check on return code

Message ID 20240920-fix-adp5588-err-check-v1-1-81f6e957ef24@analog.com
State New
Headers show
Series Input: adp5588-keys: fix check on return code | expand

Commit Message

Nuno Sa via B4 Relay Sept. 20, 2024, 7:22 a.m. UTC
From: Nuno Sa <nuno.sa@analog.com>

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")
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
---
 drivers/input/keyboard/adp5588-keys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: 55bef83509f0cbe4cc54a583ac0313389dabee66
change-id: 20240920-fix-adp5588-err-check-6ee553b7b856
--

Thanks!
- Nuno Sá
diff mbox series

Patch

diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index b5f4becf5cb6f..d25d63a807f23 100644
--- a/drivers/input/keyboard/adp5588-keys.c
+++ b/drivers/input/keyboard/adp5588-keys.c
@@ -620,7 +620,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;
 	}