* [PATCH 00/10] Handle platform_get_irq's error checking and returns
@ 2017-11-17 19:15 Arvind Yadav
2017-11-17 19:15 ` [PATCH 01/10] Input: ep93xx_keypad: Fix platform_get_irq's error checking Arvind Yadav
` (10 more replies)
0 siblings, 11 replies; 19+ messages in thread
From: Arvind Yadav @ 2017-11-17 19:15 UTC (permalink / raw)
To: dmitry.torokhov, maxime.ripard, wens, linux, wsa,
daniel.thompson, mcuos.com
Cc: linux-kernel, linux-input, linux-arm-kernel
The platform_get_irq() function returns negative if an error occurs.
zero or positive number on success. platform_get_irq() error checking
for zero is not correct and we must check its return value.
Arvind Yadav (10):
[PATCH 01/10] Input: ep93xx_keypad: Fix platform_get_irq's error checking
[PATCH 02/10] Input: omap4-keypad: Fix platform_get_irq's error checking
[PATCH 03/10] Input: twl4030_keypad: Fix platform_get_irq's error checking
[PATCH 04/10] Input: serio: Fix platform_get_irq's error checking
[PATCH 05/10] Input: cpcap-pwrbutton: Handle return value of platform_get_irq
[PATCH 06/10] Input: w90p910_ts: Handle return value of platform_get_irq
[PATCH 07/10] Input: sun4i-ts: Handle return value of platform_get_irq
[PATCH 08/10] Input: twl4030-pwrbutton: Handle return value of platform_get_irq
[PATCH 09/10] Input: sirfsoc-onkey: Handle return value of platform_get_irq
[PATCH 10/10] Input: palmas-pwrbutton: Handle return value of platform_get_irq
drivers/input/keyboard/ep93xx_keypad.c | 2 +-
drivers/input/keyboard/omap4-keypad.c | 2 +-
drivers/input/keyboard/twl4030_keypad.c | 2 +-
drivers/input/misc/cpcap-pwrbutton.c | 3 +++
drivers/input/misc/palmas-pwrbutton.c | 5 +++++
drivers/input/misc/sirfsoc-onkey.c | 3 +++
drivers/input/misc/twl4030-pwrbutton.c | 3 +++
drivers/input/serio/sun4i-ps2.c | 2 +-
drivers/input/touchscreen/sun4i-ts.c | 3 +++
drivers/input/touchscreen/w90p910_ts.c | 4 ++++
10 files changed, 25 insertions(+), 4 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 01/10] Input: ep93xx_keypad: Fix platform_get_irq's error checking
2017-11-17 19:15 [PATCH 00/10] Handle platform_get_irq's error checking and returns Arvind Yadav
@ 2017-11-17 19:15 ` Arvind Yadav
2017-11-17 19:50 ` Dmitry Torokhov
2017-11-17 19:15 ` [PATCH 02/10] Input: omap4-keypad: " Arvind Yadav
` (9 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Arvind Yadav @ 2017-11-17 19:15 UTC (permalink / raw)
To: dmitry.torokhov, maxime.ripard, wens, linux, wsa,
daniel.thompson, mcuos.com
Cc: linux-kernel, linux-input, linux-arm-kernel
The platform_get_irq() function returns negative if an error occurs.
zero or positive number on success. platform_get_irq() error checking
for zero is not correct.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/input/keyboard/ep93xx_keypad.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c
index f77b295..67efdc9 100644
--- a/drivers/input/keyboard/ep93xx_keypad.c
+++ b/drivers/input/keyboard/ep93xx_keypad.c
@@ -257,7 +257,7 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
}
keypad->irq = platform_get_irq(pdev, 0);
- if (!keypad->irq) {
+ if (keypad->irq < 0) {
err = -ENXIO;
goto failed_free;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 02/10] Input: omap4-keypad: Fix platform_get_irq's error checking
2017-11-17 19:15 [PATCH 00/10] Handle platform_get_irq's error checking and returns Arvind Yadav
2017-11-17 19:15 ` [PATCH 01/10] Input: ep93xx_keypad: Fix platform_get_irq's error checking Arvind Yadav
@ 2017-11-17 19:15 ` Arvind Yadav
2017-11-17 20:25 ` Dmitry Torokhov
2017-11-17 19:15 ` [PATCH 03/10] Input: twl4030_keypad: " Arvind Yadav
` (8 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Arvind Yadav @ 2017-11-17 19:15 UTC (permalink / raw)
To: dmitry.torokhov, maxime.ripard, wens, linux, wsa,
daniel.thompson, mcuos.com
Cc: linux-kernel, linux-input, linux-arm-kernel
The platform_get_irq() function returns negative if an error occurs.
zero or positive number on success. platform_get_irq() error checking
for zero is not correct.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/input/keyboard/omap4-keypad.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index 940d38b..8a4b161 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -251,7 +251,7 @@ static int omap4_keypad_probe(struct platform_device *pdev)
}
irq = platform_get_irq(pdev, 0);
- if (!irq) {
+ if (irq < 0) {
dev_err(&pdev->dev, "no keyboard irq assigned\n");
return -EINVAL;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 03/10] Input: twl4030_keypad: Fix platform_get_irq's error checking
2017-11-17 19:15 [PATCH 00/10] Handle platform_get_irq's error checking and returns Arvind Yadav
2017-11-17 19:15 ` [PATCH 01/10] Input: ep93xx_keypad: Fix platform_get_irq's error checking Arvind Yadav
2017-11-17 19:15 ` [PATCH 02/10] Input: omap4-keypad: " Arvind Yadav
@ 2017-11-17 19:15 ` Arvind Yadav
2017-11-17 20:27 ` Dmitry Torokhov
2017-11-17 19:15 ` [PATCH 04/10] Input: serio: " Arvind Yadav
` (7 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Arvind Yadav @ 2017-11-17 19:15 UTC (permalink / raw)
To: dmitry.torokhov, maxime.ripard, wens, linux, wsa,
daniel.thompson, mcuos.com
Cc: linux-kernel, linux-input, linux-arm-kernel
The platform_get_irq() function returns negative if an error occurs.
zero or positive number on success. platform_get_irq() error checking
for zero is not correct.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/input/keyboard/twl4030_keypad.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
index f9f98ef..f94090e 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -389,7 +389,7 @@ static int twl4030_kp_probe(struct platform_device *pdev)
}
kp->irq = platform_get_irq(pdev, 0);
- if (!kp->irq) {
+ if (kp->irq < 0) {
dev_err(&pdev->dev, "no keyboard irq assigned\n");
return -EINVAL;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 04/10] Input: serio: Fix platform_get_irq's error checking
2017-11-17 19:15 [PATCH 00/10] Handle platform_get_irq's error checking and returns Arvind Yadav
` (2 preceding siblings ...)
2017-11-17 19:15 ` [PATCH 03/10] Input: twl4030_keypad: " Arvind Yadav
@ 2017-11-17 19:15 ` Arvind Yadav
2017-11-17 20:27 ` Dmitry Torokhov
2017-11-17 19:15 ` [PATCH 05/10] Input: cpcap-pwrbutton: Handle return value of platform_get_irq Arvind Yadav
` (6 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Arvind Yadav @ 2017-11-17 19:15 UTC (permalink / raw)
To: dmitry.torokhov, maxime.ripard, wens, linux, wsa,
daniel.thompson, mcuos.com
Cc: linux-kernel, linux-input, linux-arm-kernel
The platform_get_irq() function returns negative if an error occurs.
zero or positive number on success. platform_get_irq() error checking
for zero is not correct.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/input/serio/sun4i-ps2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/serio/sun4i-ps2.c b/drivers/input/serio/sun4i-ps2.c
index 04b96fe..405c82f 100644
--- a/drivers/input/serio/sun4i-ps2.c
+++ b/drivers/input/serio/sun4i-ps2.c
@@ -264,7 +264,7 @@ static int sun4i_ps2_probe(struct platform_device *pdev)
/* Get IRQ for the device */
irq = platform_get_irq(pdev, 0);
- if (!irq) {
+ if (irq < 0) {
dev_err(dev, "no IRQ found\n");
error = -ENXIO;
goto err_disable_clk;
--
2.7.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 05/10] Input: cpcap-pwrbutton: Handle return value of platform_get_irq
2017-11-17 19:15 [PATCH 00/10] Handle platform_get_irq's error checking and returns Arvind Yadav
` (3 preceding siblings ...)
2017-11-17 19:15 ` [PATCH 04/10] Input: serio: " Arvind Yadav
@ 2017-11-17 19:15 ` Arvind Yadav
2017-11-17 19:15 ` [PATCH 06/10] Input: w90p910_ts: " Arvind Yadav
` (5 subsequent siblings)
10 siblings, 0 replies; 19+ messages in thread
From: Arvind Yadav @ 2017-11-17 19:15 UTC (permalink / raw)
To: dmitry.torokhov, maxime.ripard, wens, linux, wsa,
daniel.thompson, mcuos.com
Cc: linux-kernel, linux-input, linux-arm-kernel
platform_get_irq() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/input/misc/cpcap-pwrbutton.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/input/misc/cpcap-pwrbutton.c b/drivers/input/misc/cpcap-pwrbutton.c
index 0abef63..a4962e7 100644
--- a/drivers/input/misc/cpcap-pwrbutton.c
+++ b/drivers/input/misc/cpcap-pwrbutton.c
@@ -57,6 +57,9 @@ static int cpcap_power_button_probe(struct platform_device *pdev)
int irq = platform_get_irq(pdev, 0);
int err;
+ if (irq < 0)
+ return -ENODEV;
+
button = devm_kmalloc(&pdev->dev, sizeof(*button), GFP_KERNEL);
if (!button)
return -ENOMEM;
--
2.7.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 06/10] Input: w90p910_ts: Handle return value of platform_get_irq
2017-11-17 19:15 [PATCH 00/10] Handle platform_get_irq's error checking and returns Arvind Yadav
` (4 preceding siblings ...)
2017-11-17 19:15 ` [PATCH 05/10] Input: cpcap-pwrbutton: Handle return value of platform_get_irq Arvind Yadav
@ 2017-11-17 19:15 ` Arvind Yadav
2017-11-17 19:15 ` [PATCH 07/10] Input: sun4i-ts: " Arvind Yadav
` (4 subsequent siblings)
10 siblings, 0 replies; 19+ messages in thread
From: Arvind Yadav @ 2017-11-17 19:15 UTC (permalink / raw)
To: dmitry.torokhov, maxime.ripard, wens, linux, wsa,
daniel.thompson, mcuos.com
Cc: linux-kernel, linux-input, linux-arm-kernel
platform_get_irq() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/input/touchscreen/w90p910_ts.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/input/touchscreen/w90p910_ts.c b/drivers/input/touchscreen/w90p910_ts.c
index 638c1d7..fa74f2c 100644
--- a/drivers/input/touchscreen/w90p910_ts.c
+++ b/drivers/input/touchscreen/w90p910_ts.c
@@ -277,6 +277,10 @@ static int w90x900ts_probe(struct platform_device *pdev)
input_set_drvdata(input_dev, w90p910_ts);
w90p910_ts->irq_num = platform_get_irq(pdev, 0);
+ if (w90p910_ts->irq_num < 0) {
+ err = w90p910_ts->irq_num;
+ goto fail4;
+ }
if (request_irq(w90p910_ts->irq_num, w90p910_ts_interrupt,
0, "w90p910ts", w90p910_ts)) {
err = -EBUSY;
--
2.7.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 07/10] Input: sun4i-ts: Handle return value of platform_get_irq
2017-11-17 19:15 [PATCH 00/10] Handle platform_get_irq's error checking and returns Arvind Yadav
` (5 preceding siblings ...)
2017-11-17 19:15 ` [PATCH 06/10] Input: w90p910_ts: " Arvind Yadav
@ 2017-11-17 19:15 ` Arvind Yadav
2017-11-17 19:56 ` Dmitry Torokhov
2017-11-17 19:15 ` [PATCH 08/10] Input: twl4030-pwrbutton: " Arvind Yadav
` (3 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Arvind Yadav @ 2017-11-17 19:15 UTC (permalink / raw)
To: dmitry.torokhov, maxime.ripard, wens, linux, wsa,
daniel.thompson, mcuos.com
Cc: linux-kernel, linux-input, linux-arm-kernel
platform_get_irq() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/input/touchscreen/sun4i-ts.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
index d2e14d9..2753fd3 100644
--- a/drivers/input/touchscreen/sun4i-ts.c
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -315,6 +315,9 @@ static int sun4i_ts_probe(struct platform_device *pdev)
return PTR_ERR(ts->base);
ts->irq = platform_get_irq(pdev, 0);
+ if (ts->irq < 0)
+ return ts->irq;
+
error = devm_request_irq(dev, ts->irq, sun4i_ts_irq, 0, "sun4i-ts", ts);
if (error)
return error;
--
2.7.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 08/10] Input: twl4030-pwrbutton: Handle return value of platform_get_irq
2017-11-17 19:15 [PATCH 00/10] Handle platform_get_irq's error checking and returns Arvind Yadav
` (6 preceding siblings ...)
2017-11-17 19:15 ` [PATCH 07/10] Input: sun4i-ts: " Arvind Yadav
@ 2017-11-17 19:15 ` Arvind Yadav
2017-11-17 19:56 ` Dmitry Torokhov
2017-11-17 19:15 ` [PATCH 09/10] Input: sirfsoc-onkey: " Arvind Yadav
` (2 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Arvind Yadav @ 2017-11-17 19:15 UTC (permalink / raw)
To: dmitry.torokhov, maxime.ripard, wens, linux, wsa,
daniel.thompson, mcuos.com
Cc: linux-kernel, linux-input, linux-arm-kernel
platform_get_irq() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/input/misc/twl4030-pwrbutton.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index b307cca..0dcf311 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -58,6 +58,9 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
int irq = platform_get_irq(pdev, 0);
int err;
+ if (irq < 0)
+ return -ENOMEM;
+
pwr = devm_input_allocate_device(&pdev->dev);
if (!pwr) {
dev_err(&pdev->dev, "Can't allocate power button\n");
--
2.7.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 09/10] Input: sirfsoc-onkey: Handle return value of platform_get_irq
2017-11-17 19:15 [PATCH 00/10] Handle platform_get_irq's error checking and returns Arvind Yadav
` (7 preceding siblings ...)
2017-11-17 19:15 ` [PATCH 08/10] Input: twl4030-pwrbutton: " Arvind Yadav
@ 2017-11-17 19:15 ` Arvind Yadav
2017-11-17 19:58 ` Dmitry Torokhov
2017-11-17 19:15 ` [PATCH 10/10] Input: palmas-pwrbutton: " Arvind Yadav
2017-11-18 8:18 ` [PATCH 00/10] Handle platform_get_irq's error checking and returns Russell King - ARM Linux
10 siblings, 1 reply; 19+ messages in thread
From: Arvind Yadav @ 2017-11-17 19:15 UTC (permalink / raw)
To: dmitry.torokhov, maxime.ripard, wens, linux, wsa,
daniel.thompson, mcuos.com
Cc: linux-kernel, linux-input, linux-arm-kernel
platform_get_irq() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/input/misc/sirfsoc-onkey.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/input/misc/sirfsoc-onkey.c b/drivers/input/misc/sirfsoc-onkey.c
index 4fd038d..de04b48 100644
--- a/drivers/input/misc/sirfsoc-onkey.c
+++ b/drivers/input/misc/sirfsoc-onkey.c
@@ -149,6 +149,9 @@ static int sirfsoc_pwrc_probe(struct platform_device *pdev)
sirfsoc_pwrc_toggle_interrupts(pwrcdrv, false);
irq = platform_get_irq(pdev, 0);
+ if (irq < 0)
+ return irq;
+
error = devm_request_irq(&pdev->dev, irq,
sirfsoc_pwrc_isr, 0,
"sirfsoc_pwrc_int", pwrcdrv);
--
2.7.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 10/10] Input: palmas-pwrbutton: Handle return value of platform_get_irq
2017-11-17 19:15 [PATCH 00/10] Handle platform_get_irq's error checking and returns Arvind Yadav
` (8 preceding siblings ...)
2017-11-17 19:15 ` [PATCH 09/10] Input: sirfsoc-onkey: " Arvind Yadav
@ 2017-11-17 19:15 ` Arvind Yadav
2017-11-18 8:18 ` [PATCH 00/10] Handle platform_get_irq's error checking and returns Russell King - ARM Linux
10 siblings, 0 replies; 19+ messages in thread
From: Arvind Yadav @ 2017-11-17 19:15 UTC (permalink / raw)
To: dmitry.torokhov, maxime.ripard, wens, linux, wsa,
daniel.thompson, mcuos.com
Cc: linux-kernel, linux-input, linux-arm-kernel
platform_get_irq() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/input/misc/palmas-pwrbutton.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/input/misc/palmas-pwrbutton.c b/drivers/input/misc/palmas-pwrbutton.c
index 1e1baed..f9b05cf 100644
--- a/drivers/input/misc/palmas-pwrbutton.c
+++ b/drivers/input/misc/palmas-pwrbutton.c
@@ -210,6 +210,11 @@ static int palmas_pwron_probe(struct platform_device *pdev)
INIT_DELAYED_WORK(&pwron->input_work, palmas_power_button_work);
pwron->irq = platform_get_irq(pdev, 0);
+ if (pwron->irq < 0) {
+ error = pwron->irq;
+ goto err_free_input;
+ }
+
error = request_threaded_irq(pwron->irq, NULL, pwron_irq,
IRQF_TRIGGER_HIGH |
IRQF_TRIGGER_LOW |
--
2.7.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 01/10] Input: ep93xx_keypad: Fix platform_get_irq's error checking
2017-11-17 19:15 ` [PATCH 01/10] Input: ep93xx_keypad: Fix platform_get_irq's error checking Arvind Yadav
@ 2017-11-17 19:50 ` Dmitry Torokhov
0 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2017-11-17 19:50 UTC (permalink / raw)
To: Arvind Yadav
Cc: maxime.ripard, wens, linux, wsa, daniel.thompson, mcuos.com,
linux-kernel, linux-input, linux-arm-kernel
On Sat, Nov 18, 2017 at 12:45:23AM +0530, Arvind Yadav wrote:
> The platform_get_irq() function returns negative if an error occurs.
> zero or positive number on success. platform_get_irq() error checking
> for zero is not correct.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
> drivers/input/keyboard/ep93xx_keypad.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c
> index f77b295..67efdc9 100644
> --- a/drivers/input/keyboard/ep93xx_keypad.c
> +++ b/drivers/input/keyboard/ep93xx_keypad.c
> @@ -257,7 +257,7 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
> }
>
> keypad->irq = platform_get_irq(pdev, 0);
> - if (!keypad->irq) {
> + if (keypad->irq < 0) {
> err = -ENXIO;
We should not clobber error here, so we need:
err = keypad->irq;
> goto failed_free;
> }
> --
> 2.7.4
>
--
Dmitry
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 07/10] Input: sun4i-ts: Handle return value of platform_get_irq
2017-11-17 19:15 ` [PATCH 07/10] Input: sun4i-ts: " Arvind Yadav
@ 2017-11-17 19:56 ` Dmitry Torokhov
0 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2017-11-17 19:56 UTC (permalink / raw)
To: Arvind Yadav
Cc: maxime.ripard, wens, linux, wsa, daniel.thompson, mcuos.com,
linux-kernel, linux-input, linux-arm-kernel
On Sat, Nov 18, 2017 at 12:45:29AM +0530, Arvind Yadav wrote:
> platform_get_irq() can fail here and we must check its return value.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
> drivers/input/touchscreen/sun4i-ts.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
> index d2e14d9..2753fd3 100644
> --- a/drivers/input/touchscreen/sun4i-ts.c
> +++ b/drivers/input/touchscreen/sun4i-ts.c
> @@ -315,6 +315,9 @@ static int sun4i_ts_probe(struct platform_device *pdev)
> return PTR_ERR(ts->base);
>
> ts->irq = platform_get_irq(pdev, 0);
> + if (ts->irq < 0)
ts->irq is unsigned, you need to change it or use a temporary
(preferable).
> + return ts->irq;
> +
> error = devm_request_irq(dev, ts->irq, sun4i_ts_irq, 0, "sun4i-ts", ts);
> if (error)
> return error;
> --
> 2.7.4
>
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 08/10] Input: twl4030-pwrbutton: Handle return value of platform_get_irq
2017-11-17 19:15 ` [PATCH 08/10] Input: twl4030-pwrbutton: " Arvind Yadav
@ 2017-11-17 19:56 ` Dmitry Torokhov
0 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2017-11-17 19:56 UTC (permalink / raw)
To: Arvind Yadav
Cc: maxime.ripard, wens, linux, wsa, daniel.thompson, mcuos.com,
linux-kernel, linux-input, linux-arm-kernel
On Sat, Nov 18, 2017 at 12:45:30AM +0530, Arvind Yadav wrote:
> platform_get_irq() can fail here and we must check its return value.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
> drivers/input/misc/twl4030-pwrbutton.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
> index b307cca..0dcf311 100644
> --- a/drivers/input/misc/twl4030-pwrbutton.c
> +++ b/drivers/input/misc/twl4030-pwrbutton.c
> @@ -58,6 +58,9 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
> int irq = platform_get_irq(pdev, 0);
> int err;
>
> + if (irq < 0)
> + return -ENOMEM;
Why on earth it would translate to ENOMEM? Also, if we do the check I'd
prefer to keep assignment and the check together.
> +
> pwr = devm_input_allocate_device(&pdev->dev);
> if (!pwr) {
> dev_err(&pdev->dev, "Can't allocate power button\n");
> --
> 2.7.4
>
--
Dmitry
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 09/10] Input: sirfsoc-onkey: Handle return value of platform_get_irq
2017-11-17 19:15 ` [PATCH 09/10] Input: sirfsoc-onkey: " Arvind Yadav
@ 2017-11-17 19:58 ` Dmitry Torokhov
0 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2017-11-17 19:58 UTC (permalink / raw)
To: Arvind Yadav
Cc: maxime.ripard, wens, linux, wsa, daniel.thompson, mcuos.com,
linux-kernel, linux-input, linux-arm-kernel
On Sat, Nov 18, 2017 at 12:45:31AM +0530, Arvind Yadav wrote:
> platform_get_irq() can fail here and we must check its return value.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Applied, thank you.
> ---
> drivers/input/misc/sirfsoc-onkey.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/input/misc/sirfsoc-onkey.c b/drivers/input/misc/sirfsoc-onkey.c
> index 4fd038d..de04b48 100644
> --- a/drivers/input/misc/sirfsoc-onkey.c
> +++ b/drivers/input/misc/sirfsoc-onkey.c
> @@ -149,6 +149,9 @@ static int sirfsoc_pwrc_probe(struct platform_device *pdev)
> sirfsoc_pwrc_toggle_interrupts(pwrcdrv, false);
>
> irq = platform_get_irq(pdev, 0);
> + if (irq < 0)
> + return irq;
> +
> error = devm_request_irq(&pdev->dev, irq,
> sirfsoc_pwrc_isr, 0,
> "sirfsoc_pwrc_int", pwrcdrv);
> --
> 2.7.4
>
--
Dmitry
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 02/10] Input: omap4-keypad: Fix platform_get_irq's error checking
2017-11-17 19:15 ` [PATCH 02/10] Input: omap4-keypad: " Arvind Yadav
@ 2017-11-17 20:25 ` Dmitry Torokhov
0 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2017-11-17 20:25 UTC (permalink / raw)
To: Arvind Yadav
Cc: maxime.ripard, wens, linux, wsa, daniel.thompson, mcuos.com,
linux-kernel, linux-input, linux-arm-kernel
On Sat, Nov 18, 2017 at 12:45:24AM +0530, Arvind Yadav wrote:
> The platform_get_irq() function returns negative if an error occurs.
> zero or positive number on success. platform_get_irq() error checking
> for zero is not correct.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
> drivers/input/keyboard/omap4-keypad.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
> index 940d38b..8a4b161 100644
> --- a/drivers/input/keyboard/omap4-keypad.c
> +++ b/drivers/input/keyboard/omap4-keypad.c
> @@ -251,7 +251,7 @@ static int omap4_keypad_probe(struct platform_device *pdev)
> }
>
> irq = platform_get_irq(pdev, 0);
> - if (!irq) {
> + if (irq < 0) {
> dev_err(&pdev->dev, "no keyboard irq assigned\n");
> return -EINVAL;
return irq
> }
> --
> 2.7.4
>
--
Dmitry
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 03/10] Input: twl4030_keypad: Fix platform_get_irq's error checking
2017-11-17 19:15 ` [PATCH 03/10] Input: twl4030_keypad: " Arvind Yadav
@ 2017-11-17 20:27 ` Dmitry Torokhov
0 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2017-11-17 20:27 UTC (permalink / raw)
To: Arvind Yadav
Cc: maxime.ripard, wens, linux, wsa, daniel.thompson, mcuos.com,
linux-kernel, linux-input, linux-arm-kernel
On Sat, Nov 18, 2017 at 12:45:25AM +0530, Arvind Yadav wrote:
> The platform_get_irq() function returns negative if an error occurs.
> zero or positive number on success. platform_get_irq() error checking
> for zero is not correct.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
> drivers/input/keyboard/twl4030_keypad.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
> index f9f98ef..f94090e 100644
> --- a/drivers/input/keyboard/twl4030_keypad.c
> +++ b/drivers/input/keyboard/twl4030_keypad.c
> @@ -389,7 +389,7 @@ static int twl4030_kp_probe(struct platform_device *pdev)
> }
>
> kp->irq = platform_get_irq(pdev, 0);
> - if (!kp->irq) {
> + if (kp->irq < 0) {
kp->irq is unsigned
> dev_err(&pdev->dev, "no keyboard irq assigned\n");
> return -EINVAL;
Let's not clobber error.
> }
> --
> 2.7.4
>
--
Dmitry
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 04/10] Input: serio: Fix platform_get_irq's error checking
2017-11-17 19:15 ` [PATCH 04/10] Input: serio: " Arvind Yadav
@ 2017-11-17 20:27 ` Dmitry Torokhov
0 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2017-11-17 20:27 UTC (permalink / raw)
To: Arvind Yadav
Cc: maxime.ripard, wens, linux, wsa, daniel.thompson, mcuos.com,
linux-kernel, linux-input, linux-arm-kernel
On Sat, Nov 18, 2017 at 12:45:26AM +0530, Arvind Yadav wrote:
> The platform_get_irq() function returns negative if an error occurs.
> zero or positive number on success. platform_get_irq() error checking
> for zero is not correct.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
> drivers/input/serio/sun4i-ps2.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/serio/sun4i-ps2.c b/drivers/input/serio/sun4i-ps2.c
> index 04b96fe..405c82f 100644
> --- a/drivers/input/serio/sun4i-ps2.c
> +++ b/drivers/input/serio/sun4i-ps2.c
> @@ -264,7 +264,7 @@ static int sun4i_ps2_probe(struct platform_device *pdev)
>
> /* Get IRQ for the device */
> irq = platform_get_irq(pdev, 0);
> - if (!irq) {
> + if (irq < 0) {
irq is unsigned.
> dev_err(dev, "no IRQ found\n");
> error = -ENXIO;
I'd rather we did not clobber error.
> goto err_disable_clk;
> --
> 2.7.4
>
--
Dmitry
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 00/10] Handle platform_get_irq's error checking and returns
2017-11-17 19:15 [PATCH 00/10] Handle platform_get_irq's error checking and returns Arvind Yadav
` (9 preceding siblings ...)
2017-11-17 19:15 ` [PATCH 10/10] Input: palmas-pwrbutton: " Arvind Yadav
@ 2017-11-18 8:18 ` Russell King - ARM Linux
10 siblings, 0 replies; 19+ messages in thread
From: Russell King - ARM Linux @ 2017-11-18 8:18 UTC (permalink / raw)
To: Arvind Yadav
Cc: dmitry.torokhov, maxime.ripard, wens, linux, wsa,
daniel.thompson, mcuos.com, linux-kernel, linux-arm-kernel,
linux-input
On Sat, Nov 18, 2017 at 12:45:22AM +0530, Arvind Yadav wrote:
> The platform_get_irq() function returns negative if an error occurs.
> zero or positive number on success. platform_get_irq() error checking
> for zero is not correct and we must check its return value.
IRQ 0 is not a valid interrupt. The correct test here is <= 0.
Please rework your patches for this.
Thanks.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2017-11-18 8:19 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-17 19:15 [PATCH 00/10] Handle platform_get_irq's error checking and returns Arvind Yadav
2017-11-17 19:15 ` [PATCH 01/10] Input: ep93xx_keypad: Fix platform_get_irq's error checking Arvind Yadav
2017-11-17 19:50 ` Dmitry Torokhov
2017-11-17 19:15 ` [PATCH 02/10] Input: omap4-keypad: " Arvind Yadav
2017-11-17 20:25 ` Dmitry Torokhov
2017-11-17 19:15 ` [PATCH 03/10] Input: twl4030_keypad: " Arvind Yadav
2017-11-17 20:27 ` Dmitry Torokhov
2017-11-17 19:15 ` [PATCH 04/10] Input: serio: " Arvind Yadav
2017-11-17 20:27 ` Dmitry Torokhov
2017-11-17 19:15 ` [PATCH 05/10] Input: cpcap-pwrbutton: Handle return value of platform_get_irq Arvind Yadav
2017-11-17 19:15 ` [PATCH 06/10] Input: w90p910_ts: " Arvind Yadav
2017-11-17 19:15 ` [PATCH 07/10] Input: sun4i-ts: " Arvind Yadav
2017-11-17 19:56 ` Dmitry Torokhov
2017-11-17 19:15 ` [PATCH 08/10] Input: twl4030-pwrbutton: " Arvind Yadav
2017-11-17 19:56 ` Dmitry Torokhov
2017-11-17 19:15 ` [PATCH 09/10] Input: sirfsoc-onkey: " Arvind Yadav
2017-11-17 19:58 ` Dmitry Torokhov
2017-11-17 19:15 ` [PATCH 10/10] Input: palmas-pwrbutton: " Arvind Yadav
2017-11-18 8:18 ` [PATCH 00/10] Handle platform_get_irq's error checking and returns Russell King - ARM Linux
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).