@@ -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;
}
}
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(-)