linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: ep93xx_keypad - Add check for clk_enable() and clk_prepare_enable
@ 2024-11-11 20:20 Jiasheng Jiang
  2024-11-11 20:20 ` [PATCH] Input: samsung-keypad - Add check for clk_enable() Jiasheng Jiang
  2024-11-11 20:20 ` [PATCH] Input: spear-keyboard " Jiasheng Jiang
  0 siblings, 2 replies; 3+ messages in thread
From: Jiasheng Jiang @ 2024-11-11 20:20 UTC (permalink / raw)
  To: dmitry.torokhov, broonie, kgene.kim, kyungmin.park, jy0922.shim,
	vkoul, arnd, nikita.shubin, hartleys, christophe.jaillet,
	shiraz.linux.kernel, rajeev-dlh.kumar
  Cc: linux-input, linux-kernel, Jiasheng Jiang

Add check for the return value of clk_enable() and clk_prepare_enable()
in order to catch the potential exception.

Fixes: e06003af56c3 ("Input: add matrix keypad driver for Cirrus EP93xx")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
---
 drivers/input/keyboard/ep93xx_keypad.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c
index dcbc50304a5a..06252694f2da 100644
--- a/drivers/input/keyboard/ep93xx_keypad.c
+++ b/drivers/input/keyboard/ep93xx_keypad.c
@@ -141,10 +141,14 @@ static void ep93xx_keypad_config(struct ep93xx_keypad *keypad)
 static int ep93xx_keypad_open(struct input_dev *pdev)
 {
 	struct ep93xx_keypad *keypad = input_get_drvdata(pdev);
+	int ret;
 
 	if (!keypad->enabled) {
 		ep93xx_keypad_config(keypad);
-		clk_prepare_enable(keypad->clk);
+		ret = clk_prepare_enable(keypad->clk);
+		if (ret)
+			return ret;
+
 		keypad->enabled = true;
 	}
 
@@ -185,13 +189,19 @@ static int ep93xx_keypad_resume(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct ep93xx_keypad *keypad = platform_get_drvdata(pdev);
 	struct input_dev *input_dev = keypad->input_dev;
+	int ret;
 
 	mutex_lock(&input_dev->mutex);
 
 	if (input_device_enabled(input_dev)) {
 		if (!keypad->enabled) {
 			ep93xx_keypad_config(keypad);
-			clk_enable(keypad->clk);
+			ret = clk_enable(keypad->clk);
+			if (ret) {
+				mutex_unlock(&input_dev->mutex);
+				return ret;
+			}
+
 			keypad->enabled = true;
 		}
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-11 20:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-11 20:20 [PATCH] Input: ep93xx_keypad - Add check for clk_enable() and clk_prepare_enable Jiasheng Jiang
2024-11-11 20:20 ` [PATCH] Input: samsung-keypad - Add check for clk_enable() Jiasheng Jiang
2024-11-11 20:20 ` [PATCH] Input: spear-keyboard " Jiasheng Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).