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: spear-keyboard - Add check for clk_enable()
Date: Mon, 11 Nov 2024 20:20:06 +0000 [thread overview]
Message-ID: <20241111202006.6669-3-jiashengjiangcool@gmail.com> (raw)
In-Reply-To: <20241111202006.6669-1-jiashengjiangcool@gmail.com>
Add check for the return value of clk_enable() in order to catch the
potential exception.
Fixes: 8314f532ebd5 ("Input: spear_keyboard - reconfigure operating frequency on suspend")
Fixes: bc95df78c456 ("Input: add support for keyboards on ST SPEAr platform")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
---
drivers/input/keyboard/spear-keyboard.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
index 1df4feb8ba01..fe0a33862e60 100644
--- a/drivers/input/keyboard/spear-keyboard.c
+++ b/drivers/input/keyboard/spear-keyboard.c
@@ -273,11 +273,16 @@ static int spear_kbd_suspend(struct device *dev)
struct spear_kbd *kbd = platform_get_drvdata(pdev);
struct input_dev *input_dev = kbd->input;
unsigned int rate = 0, mode_ctl_reg, val;
+ int ret;
mutex_lock(&input_dev->mutex);
/* explicitly enable clock as we may program device */
- clk_enable(kbd->clk);
+ ret = clk_enable(kbd->clk);
+ if (ret) {
+ mutex_unlock(&input_dev->mutex);
+ return ret;
+ }
mode_ctl_reg = readl_relaxed(kbd->io_base + MODE_CTL_REG);
@@ -325,6 +330,7 @@ static int spear_kbd_resume(struct device *dev)
struct platform_device *pdev = to_platform_device(dev);
struct spear_kbd *kbd = platform_get_drvdata(pdev);
struct input_dev *input_dev = kbd->input;
+ int ret;
mutex_lock(&input_dev->mutex);
@@ -334,8 +340,13 @@ static int spear_kbd_resume(struct device *dev)
disable_irq_wake(kbd->irq);
}
} else {
- if (input_device_enabled(input_dev))
- clk_enable(kbd->clk);
+ if (input_device_enabled(input_dev)) {
+ ret = clk_enable(kbd->clk);
+ if (ret) {
+ mutex_unlock(&input_dev->mutex);
+ return ret;
+ }
+ }
}
/* restore current configuration */
--
2.25.1
prev parent 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 [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 ` Jiasheng Jiang [this message]
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-3-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
all inboxes | Powered by JetHome®