From: Jiasheng Jiang <jiashengjiangcool@gmail.com>
To: dmitry.torokhov@gmail.com, broonie@opensource.wolfsonmicro.com,
kgene.kim@samsung.com, kyungmin.park@samsung.com,
jy0922.shim@samsung.com, vkoul@kernel.org, arnd@arndb.de,
nikita.shubin@maquefel.me, hartleys@visionengravers.com,
christophe.jaillet@wanadoo.fr, shiraz.linux.kernel@gmail.com,
rajeev-dlh.kumar@st.com
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Jiasheng Jiang <jiashengjiangcool@gmail.com>
Subject: [PATCH] Input: ep93xx_keypad - Add check for clk_enable() and clk_prepare_enable
Date: Mon, 11 Nov 2024 20:20:04 +0000 [thread overview]
Message-ID: <20241111202006.6669-1-jiashengjiangcool@gmail.com> (raw)
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
next reply other threads:[~2024-11-11 20:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-11 20:20 Jiasheng Jiang [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241111202006.6669-1-jiashengjiangcool@gmail.com \
--to=jiashengjiangcool@gmail.com \
--cc=arnd@arndb.de \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dmitry.torokhov@gmail.com \
--cc=hartleys@visionengravers.com \
--cc=jy0922.shim@samsung.com \
--cc=kgene.kim@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nikita.shubin@maquefel.me \
--cc=rajeev-dlh.kumar@st.com \
--cc=shiraz.linux.kernel@gmail.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).