* [PATCH 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error
@ 2020-08-27 7:24 Krzysztof Kozlowski
2020-08-27 7:24 ` [PATCH 2/4] Input: omap4-keypad " Krzysztof Kozlowski
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 7:24 UTC (permalink / raw)
To: Dmitry Torokhov, Maxime Ripard, Chen-Yu Tsai,
Krzysztof Kozlowski, H Hartley Sweeten, Sebastian Reichel,
linux-input, linux-kernel, linux-arm-kernel
platform_get_irq() returns -ERRNO on error. In such case comparison
to 0 would pass the check.
Fixes: 60214f058f44 ("Input: ep93xx_keypad - update driver to new core support")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
drivers/input/keyboard/ep93xx_keypad.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c
index 7c70492d9d6b..f831f01501d5 100644
--- a/drivers/input/keyboard/ep93xx_keypad.c
+++ b/drivers/input/keyboard/ep93xx_keypad.c
@@ -250,8 +250,8 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
}
keypad->irq = platform_get_irq(pdev, 0);
- if (!keypad->irq) {
- err = -ENXIO;
+ if (keypad->irq < 0) {
+ err = keypad->irq;
goto failed_free;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] Input: omap4-keypad - Fix handling of platform_get_irq() error
2020-08-27 7:24 [PATCH 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error Krzysztof Kozlowski
@ 2020-08-27 7:24 ` Krzysztof Kozlowski
2020-08-27 7:24 ` [PATCH 3/4] Input: twl4030_keypad " Krzysztof Kozlowski
2020-08-27 7:24 ` [PATCH 4/4] Input: sun4i-ps2 " Krzysztof Kozlowski
2 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 7:24 UTC (permalink / raw)
To: Dmitry Torokhov, Maxime Ripard, Chen-Yu Tsai,
Krzysztof Kozlowski, H Hartley Sweeten, Sebastian Reichel,
linux-input, linux-kernel, linux-arm-kernel
platform_get_irq() returns -ERRNO on error. In such case comparison
to 0 would pass the check.
Fixes: f3a1ba60dbdb ("Input: omap4-keypad - use platform device helpers")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
drivers/input/keyboard/omap4-keypad.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index 94c94d7f5155..b075f1af0305 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -240,10 +240,8 @@ static int omap4_keypad_probe(struct platform_device *pdev)
}
irq = platform_get_irq(pdev, 0);
- if (!irq) {
- dev_err(&pdev->dev, "no keyboard irq assigned\n");
- return -EINVAL;
- }
+ if (irq < 0)
+ return -irq;
keypad_data = kzalloc(sizeof(struct omap4_keypad), GFP_KERNEL);
if (!keypad_data) {
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] Input: twl4030_keypad - Fix handling of platform_get_irq() error
2020-08-27 7:24 [PATCH 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error Krzysztof Kozlowski
2020-08-27 7:24 ` [PATCH 2/4] Input: omap4-keypad " Krzysztof Kozlowski
@ 2020-08-27 7:24 ` Krzysztof Kozlowski
2020-08-28 2:28 ` kernel test robot
2020-08-27 7:24 ` [PATCH 4/4] Input: sun4i-ps2 " Krzysztof Kozlowski
2 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 7:24 UTC (permalink / raw)
To: Dmitry Torokhov, Maxime Ripard, Chen-Yu Tsai,
Krzysztof Kozlowski, H Hartley Sweeten, Sebastian Reichel,
linux-input, linux-kernel, linux-arm-kernel
platform_get_irq() returns -ERRNO on error. In such case comparison
to 0 would pass the check.
Fixes: 7abf38d6d13c ("Input: twl4030-keypad - add device tree support")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
drivers/input/keyboard/twl4030_keypad.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
index af3a6824f1a4..c971a06c2c6a 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -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,
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] Input: sun4i-ps2 - Fix handling of platform_get_irq() error
2020-08-27 7:24 [PATCH 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error Krzysztof Kozlowski
2020-08-27 7:24 ` [PATCH 2/4] Input: omap4-keypad " Krzysztof Kozlowski
2020-08-27 7:24 ` [PATCH 3/4] Input: twl4030_keypad " Krzysztof Kozlowski
@ 2020-08-27 7:24 ` Krzysztof Kozlowski
2 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 7:24 UTC (permalink / raw)
To: Dmitry Torokhov, Maxime Ripard, Chen-Yu Tsai,
Krzysztof Kozlowski, H Hartley Sweeten, Sebastian Reichel,
linux-input, linux-kernel, linux-arm-kernel
platform_get_irq() returns -ERRNO on error. In such case comparison
to 0 would pass the check.
Fixes: e443631d20f5 ("Input: serio - add support for Alwinner A10/A20 PS/2 controller")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
drivers/input/serio/sun4i-ps2.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/input/serio/sun4i-ps2.c b/drivers/input/serio/sun4i-ps2.c
index a681a2c04e39..7da1ea8741fc 100644
--- a/drivers/input/serio/sun4i-ps2.c
+++ b/drivers/input/serio/sun4i-ps2.c
@@ -265,9 +265,8 @@ static int sun4i_ps2_probe(struct platform_device *pdev)
/* Get IRQ for the device */
irq = platform_get_irq(pdev, 0);
- if (!irq) {
- dev_err(dev, "no IRQ found\n");
- error = -ENXIO;
+ if (irq < 0) {
+ error = irq;
goto err_disable_clk;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 3/4] Input: twl4030_keypad - Fix handling of platform_get_irq() error
2020-08-27 7:24 ` [PATCH 3/4] Input: twl4030_keypad " Krzysztof Kozlowski
@ 2020-08-28 2:28 ` kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2020-08-28 2:28 UTC (permalink / raw)
To: Krzysztof Kozlowski, Dmitry Torokhov, Maxime Ripard,
Chen-Yu Tsai, H Hartley Sweeten, Sebastian Reichel, linux-input,
linux-kernel, linux-arm-kernel
Cc: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 5042 bytes --]
Hi Krzysztof,
I love your patch! Perhaps something to improve:
[auto build test WARNING on input/next]
[also build test WARNING on sunxi/sunxi/for-next linus/master v5.9-rc2 next-20200827]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Krzysztof-Kozlowski/Input-ep93xx_keypad-Fix-handling-of-platform_get_irq-error/20200827-152706
base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: i386-randconfig-m021-20200828 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
smatch warnings:
drivers/input/keyboard/twl4030_keypad.c:379 twl4030_kp_probe() warn: unsigned 'kp->irq' is never less than zero.
# https://github.com/0day-ci/linux/commit/d83af6799bafdf8f1f84ddfc48876f621735963b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Krzysztof-Kozlowski/Input-ep93xx_keypad-Fix-handling-of-platform_get_irq-error/20200827-152706
git checkout d83af6799bafdf8f1f84ddfc48876f621735963b
vim +379 drivers/input/keyboard/twl4030_keypad.c
318
319 /*
320 * Registers keypad device with input subsystem
321 * and configures TWL4030 keypad registers
322 */
323 static int twl4030_kp_probe(struct platform_device *pdev)
324 {
325 struct twl4030_keypad_data *pdata = dev_get_platdata(&pdev->dev);
326 const struct matrix_keymap_data *keymap_data = NULL;
327 struct twl4030_keypad *kp;
328 struct input_dev *input;
329 u8 reg;
330 int error;
331
332 kp = devm_kzalloc(&pdev->dev, sizeof(*kp), GFP_KERNEL);
333 if (!kp)
334 return -ENOMEM;
335
336 input = devm_input_allocate_device(&pdev->dev);
337 if (!input)
338 return -ENOMEM;
339
340 /* get the debug device */
341 kp->dbg_dev = &pdev->dev;
342 kp->input = input;
343
344 /* setup input device */
345 input->name = "TWL4030 Keypad";
346 input->phys = "twl4030_keypad/input0";
347
348 input->id.bustype = BUS_HOST;
349 input->id.vendor = 0x0001;
350 input->id.product = 0x0001;
351 input->id.version = 0x0003;
352
353 if (pdata) {
354 if (!pdata->rows || !pdata->cols || !pdata->keymap_data) {
355 dev_err(&pdev->dev, "Missing platform_data\n");
356 return -EINVAL;
357 }
358
359 kp->n_rows = pdata->rows;
360 kp->n_cols = pdata->cols;
361 kp->autorepeat = pdata->rep;
362 keymap_data = pdata->keymap_data;
363 } else {
364 error = matrix_keypad_parse_properties(&pdev->dev, &kp->n_rows,
365 &kp->n_cols);
366 if (error)
367 return error;
368
369 kp->autorepeat = true;
370 }
371
372 if (kp->n_rows > TWL4030_MAX_ROWS || kp->n_cols > TWL4030_MAX_COLS) {
373 dev_err(&pdev->dev,
374 "Invalid rows/cols amount specified in platform/devicetree data\n");
375 return -EINVAL;
376 }
377
378 kp->irq = platform_get_irq(pdev, 0);
> 379 if (kp->irq < 0)
380 return kp->irq;
381
382 error = matrix_keypad_build_keymap(keymap_data, NULL,
383 TWL4030_MAX_ROWS,
384 1 << TWL4030_ROW_SHIFT,
385 kp->keymap, input);
386 if (error) {
387 dev_err(kp->dbg_dev, "Failed to build keymap\n");
388 return error;
389 }
390
391 input_set_capability(input, EV_MSC, MSC_SCAN);
392 /* Enable auto repeat feature of Linux input subsystem */
393 if (kp->autorepeat)
394 __set_bit(EV_REP, input->evbit);
395
396 error = input_register_device(input);
397 if (error) {
398 dev_err(kp->dbg_dev,
399 "Unable to register twl4030 keypad device\n");
400 return error;
401 }
402
403 error = twl4030_kp_program(kp);
404 if (error)
405 return error;
406
407 /*
408 * This ISR will always execute in kernel thread context because of
409 * the need to access the TWL4030 over the I2C bus.
410 *
411 * NOTE: we assume this host is wired to TWL4040 INT1, not INT2 ...
412 */
413 error = devm_request_threaded_irq(&pdev->dev, kp->irq, NULL, do_kp_irq,
414 0, pdev->name, kp);
415 if (error) {
416 dev_info(kp->dbg_dev, "request_irq failed for irq no=%d: %d\n",
417 kp->irq, error);
418 return error;
419 }
420
421 /* Enable KP and TO interrupts now. */
422 reg = (u8) ~(KEYP_IMR1_KP | KEYP_IMR1_TO);
423 if (twl4030_kpwrite_u8(kp, reg, KEYP_IMR1)) {
424 /* mask all events - we don't care about the result */
425 (void) twl4030_kpwrite_u8(kp, 0xff, KEYP_IMR1);
426 return -EIO;
427 }
428
429 return 0;
430 }
431
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31197 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-08-28 2:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 7:24 [PATCH 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error Krzysztof Kozlowski
2020-08-27 7:24 ` [PATCH 2/4] Input: omap4-keypad " Krzysztof Kozlowski
2020-08-27 7:24 ` [PATCH 3/4] Input: twl4030_keypad " Krzysztof Kozlowski
2020-08-28 2:28 ` kernel test robot
2020-08-27 7:24 ` [PATCH 4/4] Input: sun4i-ps2 " Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).