Commit 117b2dc5 authored by Arvind Yadav's avatar Arvind Yadav Committed by Dmitry Torokhov

Input: pxa27x_keypad - handle return value of clk_prepare_enable

clk_prepare_enable() can fail here and we must check its return value.
Signed-off-by: default avatarArvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 8a7f102c
...@@ -644,9 +644,12 @@ static void pxa27x_keypad_config(struct pxa27x_keypad *keypad) ...@@ -644,9 +644,12 @@ static void pxa27x_keypad_config(struct pxa27x_keypad *keypad)
static int pxa27x_keypad_open(struct input_dev *dev) static int pxa27x_keypad_open(struct input_dev *dev)
{ {
struct pxa27x_keypad *keypad = input_get_drvdata(dev); struct pxa27x_keypad *keypad = input_get_drvdata(dev);
int ret;
/* Enable unit clock */ /* Enable unit clock */
clk_prepare_enable(keypad->clk); ret = clk_prepare_enable(keypad->clk);
if (ret)
return ret;
pxa27x_keypad_config(keypad); pxa27x_keypad_config(keypad);
return 0; return 0;
...@@ -683,6 +686,7 @@ static int pxa27x_keypad_resume(struct device *dev) ...@@ -683,6 +686,7 @@ static int pxa27x_keypad_resume(struct device *dev)
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); struct pxa27x_keypad *keypad = platform_get_drvdata(pdev);
struct input_dev *input_dev = keypad->input_dev; struct input_dev *input_dev = keypad->input_dev;
int ret = 0;
/* /*
* If the keypad is used as wake up source, the clock is not turned * If the keypad is used as wake up source, the clock is not turned
...@@ -695,14 +699,15 @@ static int pxa27x_keypad_resume(struct device *dev) ...@@ -695,14 +699,15 @@ static int pxa27x_keypad_resume(struct device *dev)
if (input_dev->users) { if (input_dev->users) {
/* Enable unit clock */ /* Enable unit clock */
clk_prepare_enable(keypad->clk); ret = clk_prepare_enable(keypad->clk);
if (!ret)
pxa27x_keypad_config(keypad); pxa27x_keypad_config(keypad);
} }
mutex_unlock(&input_dev->mutex); mutex_unlock(&input_dev->mutex);
} }
return 0; return ret;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment