Skip to content

Commit f1e5f68

Browse files
committed
Input: samsung-keypad - use guard notation to acquire mutex
Guard notation is more compact and ensures that the mutex will be released when control leaves the function. Reviewed-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 5658439 commit f1e5f68

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/input/keyboard/samsung-keypad.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -510,15 +510,13 @@ static int samsung_keypad_suspend(struct device *dev)
510510
struct samsung_keypad *keypad = platform_get_drvdata(pdev);
511511
struct input_dev *input_dev = keypad->input_dev;
512512

513-
mutex_lock(&input_dev->mutex);
513+
guard(mutex)(&input_dev->mutex);
514514

515515
if (input_device_enabled(input_dev))
516516
samsung_keypad_stop(keypad);
517517

518518
samsung_keypad_toggle_wakeup(keypad, true);
519519

520-
mutex_unlock(&input_dev->mutex);
521-
522520
return 0;
523521
}
524522

@@ -528,15 +526,13 @@ static int samsung_keypad_resume(struct device *dev)
528526
struct samsung_keypad *keypad = platform_get_drvdata(pdev);
529527
struct input_dev *input_dev = keypad->input_dev;
530528

531-
mutex_lock(&input_dev->mutex);
529+
guard(mutex)(&input_dev->mutex);
532530

533531
samsung_keypad_toggle_wakeup(keypad, false);
534532

535533
if (input_device_enabled(input_dev))
536534
samsung_keypad_start(keypad);
537535

538-
mutex_unlock(&input_dev->mutex);
539-
540536
return 0;
541537
}
542538

0 commit comments

Comments
 (0)