diff options
| author | Surendra Singh Chouhan <kr494167@gmail.com> | 2026-07-23 07:59:43 +0530 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2026-07-24 18:18:47 -0700 |
| commit | e640910640676b88883db616c78bd26dc9eab428 (patch) | |
| tree | d9277b4fc0cc3cdfe5d1bc1eb635d5bf054cf692 /drivers/input | |
| parent | 0aa7c205e901ad75f4785f786b32a2b01b896a9b (diff) | |
| download | linux-next-e640910640676b88883db616c78bd26dc9eab428.tar.gz linux-next-e640910640676b88883db616c78bd26dc9eab428.zip | |
Input: charlieplex_keypad - check gpiod_direction_output() return value
charlieplex_keypad_scan_line() currently ignores the return value of
gpiod_direction_output() when setting the active output line for scanning.
If setting the GPIO direction fails (e.g. on I2C/SPI GPIO expanders or
hardware errors), the function continues to sleep and read input values
from an improperly configured GPIO line.
Fix this by capturing the return value of gpiod_direction_output() and
returning the error code immediately if it fails.
Fixes: 2ca45e57ea02 ("Input: charlieplex_keypad - add GPIO charlieplex keypad")
Signed-off-by: Surendra Singh Chouhan <kr494167@gmail.com>
Link: https://patch.msgid.link/20260723022943.9337-1-kr494167@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
| -rw-r--r-- | drivers/input/keyboard/charlieplex_keypad.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/input/keyboard/charlieplex_keypad.c b/drivers/input/keyboard/charlieplex_keypad.c index d222b622c820..d46a2298e6da 100644 --- a/drivers/input/keyboard/charlieplex_keypad.c +++ b/drivers/input/keyboard/charlieplex_keypad.c @@ -77,7 +77,9 @@ static int charlieplex_keypad_scan_line(struct charlieplex_keypad *keypad, int err; /* Activate only one line as output at a time. */ - gpiod_direction_output(line_gpios->desc[oline], 1); + err = gpiod_direction_output(line_gpios->desc[oline], 1); + if (err) + return err; if (keypad->settling_time_us) fsleep(keypad->settling_time_us); |
