diff mbox series

Input: omap4-keypad - Fix pm_runtime_get_sync() error checking

Message ID 20220412070131.19848-1-linmq006@gmail.com
State Accepted
Commit 81022a170462d38ea10612cb67e8e2c529d58abe
Headers show
Series Input: omap4-keypad - Fix pm_runtime_get_sync() error checking | expand

Commit Message

Miaoqian Lin April 12, 2022, 7:01 a.m. UTC
If the device is already in a runtime PM enabled state
pm_runtime_get_sync() will return 1, so a test for negative
value should be used to check for errors.

Fixes: f77621cc640a ("Input: omap-keypad - dynamically handle register offsets")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/input/keyboard/omap4-keypad.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dmitry Torokhov April 17, 2022, 8:04 p.m. UTC | #1
On Tue, Apr 12, 2022 at 07:01:26AM +0000, Miaoqian Lin wrote:
> If the device is already in a runtime PM enabled state
> pm_runtime_get_sync() will return 1, so a test for negative
> value should be used to check for errors.
> 
> Fixes: f77621cc640a ("Input: omap-keypad - dynamically handle register offsets")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Applied, thank you.
diff mbox series

Patch

diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index 43375b38ee59..8a7ce41b8c56 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -393,7 +393,7 @@  static int omap4_keypad_probe(struct platform_device *pdev)
 	 * revision register.
 	 */
 	error = pm_runtime_get_sync(dev);
-	if (error) {
+	if (error < 0) {
 		dev_err(dev, "pm_runtime_get_sync() failed\n");
 		pm_runtime_put_noidle(dev);
 		return error;