Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240819045813.2154642-7-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+2 -6
+2 -6
drivers/input/keyboard/samsung-keypad.c
··· 510 510 struct samsung_keypad *keypad = platform_get_drvdata(pdev); 511 511 struct input_dev *input_dev = keypad->input_dev; 512 512 513 - mutex_lock(&input_dev->mutex); 513 + guard(mutex)(&input_dev->mutex); 514 514 515 515 if (input_device_enabled(input_dev)) 516 516 samsung_keypad_stop(keypad); 517 517 518 518 samsung_keypad_toggle_wakeup(keypad, true); 519 - 520 - mutex_unlock(&input_dev->mutex); 521 519 522 520 return 0; 523 521 } ··· 526 528 struct samsung_keypad *keypad = platform_get_drvdata(pdev); 527 529 struct input_dev *input_dev = keypad->input_dev; 528 530 529 - mutex_lock(&input_dev->mutex); 531 + guard(mutex)(&input_dev->mutex); 530 532 531 533 samsung_keypad_toggle_wakeup(keypad, false); 532 534 533 535 if (input_device_enabled(input_dev)) 534 536 samsung_keypad_start(keypad); 535 - 536 - mutex_unlock(&input_dev->mutex); 537 537 538 538 return 0; 539 539 }