Commit c277e1f0 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Dmitry Torokhov

Input: twl4030_keypad - fix handling of platform_get_irq() error

platform_get_irq() returns -ERRNO on error.  In such case casting to
unsigned and comparing to 0 would pass the check.

Fixes: 7abf38d6 ("Input: twl4030-keypad - add device tree support")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20200828145744.3636-3-krzk@kernel.orgSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 4738dd19
...@@ -50,7 +50,7 @@ struct twl4030_keypad { ...@@ -50,7 +50,7 @@ struct twl4030_keypad {
bool autorepeat; bool autorepeat;
unsigned int n_rows; unsigned int n_rows;
unsigned int n_cols; unsigned int n_cols;
unsigned int irq; int irq;
struct device *dbg_dev; struct device *dbg_dev;
struct input_dev *input; struct input_dev *input;
...@@ -376,10 +376,8 @@ static int twl4030_kp_probe(struct platform_device *pdev) ...@@ -376,10 +376,8 @@ static int twl4030_kp_probe(struct platform_device *pdev)
} }
kp->irq = platform_get_irq(pdev, 0); kp->irq = platform_get_irq(pdev, 0);
if (!kp->irq) { if (kp->irq < 0)
dev_err(&pdev->dev, "no keyboard irq assigned\n"); return kp->irq;
return -EINVAL;
}
error = matrix_keypad_build_keymap(keymap_data, NULL, error = matrix_keypad_build_keymap(keymap_data, NULL,
TWL4030_MAX_ROWS, TWL4030_MAX_ROWS,
......
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