[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240825051627.2848495-13-dmitry.torokhov@gmail.com>
Date: Sat, 24 Aug 2024 22:16:16 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: linux-input@...r.kernel.org
Cc: Michael Hennerich <michael.hennerich@...log.com>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
Laxman Dewangan <ldewangan@...dia.com>,
Thierry Reding <thierry.reding@...il.com>,
Hans de Goede <hdegoede@...hat.com>,
Tony Lindgren <tony@...mide.com>,
Jeff LaBundy <jeff@...undy.com>,
linux-kernel@...r.kernel.org,
imx@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org,
linux-tegra@...r.kernel.org
Subject: [PATCH 12/17] 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.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
---
drivers/input/keyboard/omap4-keypad.c | 4 +---
1 file changed, 1 insertion(+), 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 */
--
2.46.0.295.g3b9ea8a38a-goog
Powered by blists - more mailing lists