diff options
| author | Arvind Yadav <arvind.yadav.cs@gmail.com> | 2017-08-31 14:39:13 -0400 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-08-31 14:57:35 -0400 |
| commit | 117b2dc58c07924da7f545f93a1f5862f46e14f7 (patch) | |
| tree | dac55bdad92dd0feab8cf8c4818d7d40b45bba9b | |
| parent | 8a7f102c4b15940e43b712d35da357a2c05ffb84 (diff) | |
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>
| -rw-r--r-- | drivers/input/keyboard/pxa27x_keypad.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index 3841fa30db33..d0bdaeadf86d 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c | |||
| @@ -644,9 +644,12 @@ static void pxa27x_keypad_config(struct pxa27x_keypad *keypad) | |||
| 644 | static int pxa27x_keypad_open(struct input_dev *dev) | 644 | static int pxa27x_keypad_open(struct input_dev *dev) |
| 645 | { | 645 | { |
| 646 | struct pxa27x_keypad *keypad = input_get_drvdata(dev); | 646 | struct pxa27x_keypad *keypad = input_get_drvdata(dev); |
| 647 | 647 | int ret; | |
| 648 | /* Enable unit clock */ | 648 | /* Enable unit clock */ |
| 649 | clk_prepare_enable(keypad->clk); | 649 | ret = clk_prepare_enable(keypad->clk); |
| 650 | if (ret) | ||
| 651 | return ret; | ||
| 652 | |||
| 650 | pxa27x_keypad_config(keypad); | 653 | pxa27x_keypad_config(keypad); |
| 651 | 654 | ||
| 652 | return 0; | 655 | return 0; |
| @@ -683,6 +686,7 @@ static int pxa27x_keypad_resume(struct device *dev) | |||
| 683 | struct platform_device *pdev = to_platform_device(dev); | 686 | struct platform_device *pdev = to_platform_device(dev); |
| 684 | struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); | 687 | struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); |
| 685 | struct input_dev *input_dev = keypad->input_dev; | 688 | struct input_dev *input_dev = keypad->input_dev; |
| 689 | int ret = 0; | ||
| 686 | 690 | ||
| 687 | /* | 691 | /* |
| 688 | * If the keypad is used as wake up source, the clock is not turned | 692 | * 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 | 699 | ||
| 696 | if (input_dev->users) { | 700 | if (input_dev->users) { |
| 697 | /* Enable unit clock */ | 701 | /* Enable unit clock */ |
| 698 | clk_prepare_enable(keypad->clk); | 702 | ret = clk_prepare_enable(keypad->clk); |
| 699 | pxa27x_keypad_config(keypad); | 703 | if (!ret) |
| 704 | pxa27x_keypad_config(keypad); | ||
| 700 | } | 705 | } |
| 701 | 706 | ||
| 702 | mutex_unlock(&input_dev->mutex); | 707 | mutex_unlock(&input_dev->mutex); |
| 703 | } | 708 | } |
| 704 | 709 | ||
| 705 | return 0; | 710 | return ret; |
| 706 | } | 711 | } |
| 707 | #endif | 712 | #endif |
| 708 | 713 | ||
