Skip to content

Commit 117b2dc

Browse files
ArvindYadavCsdtor
authored andcommitted
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: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 8a7f102 commit 117b2dc

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

drivers/input/keyboard/pxa27x_keypad.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,12 @@ static void pxa27x_keypad_config(struct pxa27x_keypad *keypad)
644644
static int pxa27x_keypad_open(struct input_dev *dev)
645645
{
646646
struct pxa27x_keypad *keypad = input_get_drvdata(dev);
647-
647+
int ret;
648648
/* Enable unit clock */
649-
clk_prepare_enable(keypad->clk);
649+
ret = clk_prepare_enable(keypad->clk);
650+
if (ret)
651+
return ret;
652+
650653
pxa27x_keypad_config(keypad);
651654

652655
return 0;
@@ -683,6 +686,7 @@ static int pxa27x_keypad_resume(struct device *dev)
683686
struct platform_device *pdev = to_platform_device(dev);
684687
struct pxa27x_keypad *keypad = platform_get_drvdata(pdev);
685688
struct input_dev *input_dev = keypad->input_dev;
689+
int ret = 0;
686690

687691
/*
688692
* 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)
695699

696700
if (input_dev->users) {
697701
/* Enable unit clock */
698-
clk_prepare_enable(keypad->clk);
699-
pxa27x_keypad_config(keypad);
702+
ret = clk_prepare_enable(keypad->clk);
703+
if (!ret)
704+
pxa27x_keypad_config(keypad);
700705
}
701706

702707
mutex_unlock(&input_dev->mutex);
703708
}
704709

705-
return 0;
710+
return ret;
706711
}
707712
#endif
708713

0 commit comments

Comments
 (0)