Skip to content

Commit

Permalink
Input: twl4030_keypad - fix handling of platform_get_irq() error
Browse files Browse the repository at this point in the history
[ Upstream commit c277e1f ]

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

Fixes: 7abf38d ("Input: twl4030-keypad - add device tree support")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20200828145744.3636-3-krzk@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
krzk authored and gregkh committed Oct 29, 2020
1 parent 86f11d5 commit e186019
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/input/keyboard/twl4030_keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct twl4030_keypad {
bool autorepeat;
unsigned int n_rows;
unsigned int n_cols;
unsigned int irq;
int irq;

struct device *dbg_dev;
struct input_dev *input;
Expand Down Expand Up @@ -376,10 +376,8 @@ static int twl4030_kp_probe(struct platform_device *pdev)
}

kp->irq = platform_get_irq(pdev, 0);
if (!kp->irq) {
dev_err(&pdev->dev, "no keyboard irq assigned\n");
return -EINVAL;
}
if (kp->irq < 0)
return kp->irq;

error = matrix_keypad_build_keymap(keymap_data, NULL,
TWL4030_MAX_ROWS,
Expand Down

0 comments on commit e186019

Please sign in to comment.