diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2024-08-24 22:16:16 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2024-10-03 08:58:57 -0700 |
commit | a49e229319b1dd7007ede184884cefdf0da6df48 (patch) | |
tree | af5d6e9c0ba45e4e9dd58ce02f939c193950e4b1 /drivers/input/keyboard | |
parent | 405b1762aef34e4bc8f39ce20ad27e2d336bbe27 (diff) |
Input: omap4-keypad - use guard notation when acquiring mutex
This makes the code more compact and error handling more robust
by ensuring that mutexes are released in all code paths when control
leaves critical section.
Link: https://lore.kernel.org/r/20240825051627.2848495-13-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r-- | drivers/input/keyboard/omap4-keypad.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index 040b340995d8..935c2b27b81c 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c @@ -144,7 +144,7 @@ static void omap4_keypad_scan_keys(struct omap4_keypad *keypad_data, u64 keys) { u64 changed; - mutex_lock(&keypad_data->lock); + guard(mutex)(&keypad_data->lock); changed = keys ^ keypad_data->keys; @@ -158,8 +158,6 @@ static void omap4_keypad_scan_keys(struct omap4_keypad *keypad_data, u64 keys) omap4_keypad_report_keys(keypad_data, changed & keys, true); keypad_data->keys = keys; - - mutex_unlock(&keypad_data->lock); } /* Interrupt handlers */ |