mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 23:22:31 +02:00
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>
This commit is contained in:
parent
405b1762ae
commit
a49e229319
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user