linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/10 v3] Input: ep93xx_keypad: Fix platform_get_irq's error checking
@ 2017-11-18 10:55 Arvind Yadav
  2017-11-18 10:55 ` [PATCH 02/10 v3] Input: omap4-keypad: " Arvind Yadav
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-11-18 10:55 UTC (permalink / raw)
  To: dmitry.torokhov, maxime.ripard, wens, mcuos.com, linux, linux, lee.jones
  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>
---
changes in v2:
               Return keypad->irq insted of -ENXIO.
changes in v3 :
               Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.

 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 f77b295..01788a7 100644
--- a/drivers/input/keyboard/ep93xx_keypad.c
+++ b/drivers/input/keyboard/ep93xx_keypad.c
@@ -257,8 +257,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.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 02/10 v3] Input: omap4-keypad: Fix platform_get_irq's error checking
  2017-11-18 10:55 [PATCH 01/10 v3] Input: ep93xx_keypad: Fix platform_get_irq's error checking Arvind Yadav
@ 2017-11-18 10:55 ` Arvind Yadav
  2017-11-18 10:55 ` [PATCH 03/10 v3] Input: twl4030_keypad: " Arvind Yadav
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-11-18 10:55 UTC (permalink / raw)
  To: dmitry.torokhov, maxime.ripard, wens, mcuos.com, linux, linux, lee.jones
  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>
---
changes in v2:
               Return irq insted of -EINVAL.
changes in v3 :
               Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.

 drivers/input/keyboard/omap4-keypad.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index 940d38b..9ad840c 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -251,9 +251,9 @@ 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;
 	}
 
 	keypad_data = kzalloc(sizeof(struct omap4_keypad), GFP_KERNEL);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 03/10 v3] Input: twl4030_keypad: Fix platform_get_irq's error checking
  2017-11-18 10:55 [PATCH 01/10 v3] Input: ep93xx_keypad: Fix platform_get_irq's error checking Arvind Yadav
  2017-11-18 10:55 ` [PATCH 02/10 v3] Input: omap4-keypad: " Arvind Yadav
@ 2017-11-18 10:55 ` Arvind Yadav
  2017-11-18 10:55 ` [PATCH 04/10 v3] Input: serio: " Arvind Yadav
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-11-18 10:55 UTC (permalink / raw)
  To: dmitry.torokhov, maxime.ripard, wens, mcuos.com, linux, linux, lee.jones
  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>
---
changes in v2 :
              kp->irq is unsigned. use temporary int variable irq.
changes in v3 :
              Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.

 drivers/input/keyboard/twl4030_keypad.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
index f9f98ef..d921238 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -341,6 +341,7 @@ static int twl4030_kp_probe(struct platform_device *pdev)
 	struct input_dev *input;
 	u8 reg;
 	int error;
+	int irq;
 
 	kp = devm_kzalloc(&pdev->dev, sizeof(*kp), GFP_KERNEL);
 	if (!kp)
@@ -388,11 +389,12 @@ static int twl4030_kp_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	kp->irq = platform_get_irq(pdev, 0);
-	if (!kp->irq) {
+	irq = platform_get_irq(pdev, 0);
+	if (irq <= 0) {
 		dev_err(&pdev->dev, "no keyboard irq assigned\n");
-		return -EINVAL;
+		return irq;
 	}
+	kp->irq = irq;
 
 	error = matrix_keypad_build_keymap(keymap_data, NULL,
 					   TWL4030_MAX_ROWS,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 04/10 v3] Input: serio: Fix platform_get_irq's error checking
  2017-11-18 10:55 [PATCH 01/10 v3] Input: ep93xx_keypad: Fix platform_get_irq's error checking Arvind Yadav
  2017-11-18 10:55 ` [PATCH 02/10 v3] Input: omap4-keypad: " Arvind Yadav
  2017-11-18 10:55 ` [PATCH 03/10 v3] Input: twl4030_keypad: " Arvind Yadav
@ 2017-11-18 10:55 ` Arvind Yadav
  2017-11-18 10:55 ` [PATCH 05/10 v3] Input: cpcap-pwrbutton: Handle return value of platform_get_irq Arvind Yadav
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-11-18 10:55 UTC (permalink / raw)
  To: dmitry.torokhov, maxime.ripard, wens, mcuos.com, linux, linux, lee.jones
  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>
---
changes in v2 :
              irq is unsigned. used struct sun4i_ps2data int variable drvdata->irq.
changes in v3 :
              Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.

 drivers/input/serio/sun4i-ps2.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/input/serio/sun4i-ps2.c b/drivers/input/serio/sun4i-ps2.c
index 04b96fe..38bb163 100644
--- a/drivers/input/serio/sun4i-ps2.c
+++ b/drivers/input/serio/sun4i-ps2.c
@@ -210,7 +210,6 @@ static int sun4i_ps2_probe(struct platform_device *pdev)
 	struct sun4i_ps2data *drvdata;
 	struct serio *serio;
 	struct device *dev = &pdev->dev;
-	unsigned int irq;
 	int error;
 
 	drvdata = kzalloc(sizeof(struct sun4i_ps2data), GFP_KERNEL);
@@ -263,14 +262,13 @@ static int sun4i_ps2_probe(struct platform_device *pdev)
 	writel(0, drvdata->reg_base + PS2_REG_GCTL);
 
 	/* Get IRQ for the device */
-	irq = platform_get_irq(pdev, 0);
-	if (!irq) {
+	drvdata->irq = platform_get_irq(pdev, 0);
+	if (drvdata->irq <= 0) {
 		dev_err(dev, "no IRQ found\n");
-		error = -ENXIO;
+		error = drvdata->irq;
 		goto err_disable_clk;
 	}
 
-	drvdata->irq = irq;
 	drvdata->serio = serio;
 	drvdata->dev = dev;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 05/10 v3] Input: cpcap-pwrbutton: Handle return value of platform_get_irq
  2017-11-18 10:55 [PATCH 01/10 v3] Input: ep93xx_keypad: Fix platform_get_irq's error checking Arvind Yadav
                   ` (2 preceding siblings ...)
  2017-11-18 10:55 ` [PATCH 04/10 v3] Input: serio: " Arvind Yadav
@ 2017-11-18 10:55 ` Arvind Yadav
       [not found] ` <76d6a73ba51e1a8a86d8d9a1d0bbbf7723d5153a.1510999334.git.arvind.yadav.cs@gmail.com>
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-11-18 10:55 UTC (permalink / raw)
  To: dmitry.torokhov, maxime.ripard, wens, mcuos.com, linux, linux, lee.jones
  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>
---
changes in v2 :
              return irq instead of -ENODEV.
changes in v3 :
              Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.

 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..3a0626b 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 irq;
+
 	button = devm_kmalloc(&pdev->dev, sizeof(*button), GFP_KERNEL);
 	if (!button)
 		return -ENOMEM;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 06/10 v2] Input: w90p910_ts: Handle return value of platform_get_irq
       [not found] ` <76d6a73ba51e1a8a86d8d9a1d0bbbf7723d5153a.1510999334.git.arvind.yadav.cs@gmail.com>
@ 2017-11-18 10:55   ` Arvind Yadav
  2017-11-18 10:55   ` [PATCH 08/10 v3] Input: twl4030-pwrbutton: " Arvind Yadav
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-11-18 10:55 UTC (permalink / raw)
  To: dmitry.torokhov, maxime.ripard, wens, mcuos.com, linux, linux, lee.jones
  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>
---
changes in v2 :
              Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.

 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] 12+ messages in thread

* [PATCH 07/10 v3] Input: sun4i-ts: Handle return value of platform_get_irq
  2017-11-18 10:55 [PATCH 01/10 v3] Input: ep93xx_keypad: Fix platform_get_irq's error checking Arvind Yadav
                   ` (4 preceding siblings ...)
       [not found] ` <76d6a73ba51e1a8a86d8d9a1d0bbbf7723d5153a.1510999334.git.arvind.yadav.cs@gmail.com>
@ 2017-11-18 10:55 ` Arvind Yadav
  2017-11-18 18:30 ` [PATCH 01/10 v3] Input: ep93xx_keypad: Fix platform_get_irq's error checking Dmitry Torokhov
  6 siblings, 0 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-11-18 10:55 UTC (permalink / raw)
  To: dmitry.torokhov, maxime.ripard, wens, mcuos.com, linux, linux, lee.jones
  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>
---
changes in v2 :
              ts->irq is unsigned. used int irq variable.
changes in v3 :
              Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.

 drivers/input/touchscreen/sun4i-ts.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
index d2e14d9..315f26b 100644
--- a/drivers/input/touchscreen/sun4i-ts.c
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -251,6 +251,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)
 	bool ts_attached;
 	u32 tp_sensitive_adjust = 15;
 	u32 filter_type = 1;
+	int irq;
 
 	ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL);
 	if (!ts)
@@ -314,7 +315,10 @@ static int sun4i_ts_probe(struct platform_device *pdev)
 	if (IS_ERR(ts->base))
 		return PTR_ERR(ts->base);
 
-	ts->irq = platform_get_irq(pdev, 0);
+	irq = platform_get_irq(pdev, 0);
+	if (irq <= 0)
+		return irq;
+	ts->irq = 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] 12+ messages in thread

* [PATCH 08/10 v3] Input: twl4030-pwrbutton: Handle return value of platform_get_irq
       [not found] ` <76d6a73ba51e1a8a86d8d9a1d0bbbf7723d5153a.1510999334.git.arvind.yadav.cs@gmail.com>
  2017-11-18 10:55   ` [PATCH 06/10 v2] Input: w90p910_ts: " Arvind Yadav
@ 2017-11-18 10:55   ` Arvind Yadav
  2017-11-18 10:55   ` [PATCH 09/10 v2] Input: sirfsoc-onkey: " Arvind Yadav
  2017-11-18 10:55   ` [PATCH 10/10 v2] Input: palmas-pwrbutton: " Arvind Yadav
  3 siblings, 0 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-11-18 10:55 UTC (permalink / raw)
  To: dmitry.torokhov, maxime.ripard, wens, mcuos.com, linux, linux, lee.jones
  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>
---
changes in v2 :
              return irq instead of -ENODEV.
changes in v3 :
              Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.

 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 irq;
+
 	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] 12+ messages in thread

* [PATCH 09/10 v2] Input: sirfsoc-onkey: Handle return value of platform_get_irq
       [not found] ` <76d6a73ba51e1a8a86d8d9a1d0bbbf7723d5153a.1510999334.git.arvind.yadav.cs@gmail.com>
  2017-11-18 10:55   ` [PATCH 06/10 v2] Input: w90p910_ts: " Arvind Yadav
  2017-11-18 10:55   ` [PATCH 08/10 v3] Input: twl4030-pwrbutton: " Arvind Yadav
@ 2017-11-18 10:55   ` Arvind Yadav
  2017-11-18 10:55   ` [PATCH 10/10 v2] Input: palmas-pwrbutton: " Arvind Yadav
  3 siblings, 0 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-11-18 10:55 UTC (permalink / raw)
  To: dmitry.torokhov, maxime.ripard, wens, mcuos.com, linux, linux, lee.jones
  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>
---
changes in v2 :
              Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.

 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] 12+ messages in thread

* [PATCH 10/10 v2] Input: palmas-pwrbutton: Handle return value of platform_get_irq
       [not found] ` <76d6a73ba51e1a8a86d8d9a1d0bbbf7723d5153a.1510999334.git.arvind.yadav.cs@gmail.com>
                     ` (2 preceding siblings ...)
  2017-11-18 10:55   ` [PATCH 09/10 v2] Input: sirfsoc-onkey: " Arvind Yadav
@ 2017-11-18 10:55   ` Arvind Yadav
  3 siblings, 0 replies; 12+ messages in thread
From: Arvind Yadav @ 2017-11-18 10:55 UTC (permalink / raw)
  To: dmitry.torokhov, maxime.ripard, wens, mcuos.com, linux, linux, lee.jones
  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>
---
changes in v2 :
              Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.

 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] 12+ messages in thread

* Re: [PATCH 01/10 v3] Input: ep93xx_keypad: Fix platform_get_irq's error checking
  2017-11-18 10:55 [PATCH 01/10 v3] Input: ep93xx_keypad: Fix platform_get_irq's error checking Arvind Yadav
                   ` (5 preceding siblings ...)
  2017-11-18 10:55 ` [PATCH 07/10 v3] Input: sun4i-ts: " Arvind Yadav
@ 2017-11-18 18:30 ` Dmitry Torokhov
  2017-11-20 16:24   ` arvindY
  6 siblings, 1 reply; 12+ messages in thread
From: Dmitry Torokhov @ 2017-11-18 18:30 UTC (permalink / raw)
  To: Arvind Yadav
  Cc: maxime.ripard, wens, mcuos.com, linux, linux, lee.jones,
	linux-kernel, linux-input, linux-arm-kernel

On Sat, Nov 18, 2017 at 04:25:08PM +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>
> ---
> changes in v2:
>                Return keypad->irq insted of -ENXIO.
> changes in v3 :
>                Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.
> 
>  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 f77b295..01788a7 100644
> --- a/drivers/input/keyboard/ep93xx_keypad.c
> +++ b/drivers/input/keyboard/ep93xx_keypad.c
> @@ -257,8 +257,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;

Argh, so what will happen if you return with keypad->irq == 0? Can you
please stop and consider what exactly  you are doing before churning
patches like crazy?

>  		goto failed_free;
>  	}
>  
> -- 
> 2.7.4
> 

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 01/10 v3] Input: ep93xx_keypad: Fix platform_get_irq's error checking
  2017-11-18 18:30 ` [PATCH 01/10 v3] Input: ep93xx_keypad: Fix platform_get_irq's error checking Dmitry Torokhov
@ 2017-11-20 16:24   ` arvindY
  0 siblings, 0 replies; 12+ messages in thread
From: arvindY @ 2017-11-20 16:24 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: maxime.ripard, wens, mcuos.com, linux, linux, lee.jones,
	linux-kernel, linux-input, linux-arm-kernel

Hi Dmitry,

On Sunday 19 November 2017 12:00 AM, Dmitry Torokhov wrote:
> On Sat, Nov 18, 2017 at 04:25:08PM +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>
>> ---
>> changes in v2:
>>                 Return keypad->irq insted of -ENXIO.
>> changes in v3 :
>>                 Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.
>>
>>   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 f77b295..01788a7 100644
>> --- a/drivers/input/keyboard/ep93xx_keypad.c
>> +++ b/drivers/input/keyboard/ep93xx_keypad.c
>> @@ -257,8 +257,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;
> Argh, so what will happen if you return with keypad->irq == 0? Can you
> please stop and consider what exactly  you are doing before churning
> patches like crazy?
Sorry for troubling you, I am sending updated patch of this( version - v4).
If you are ok with v4. Then I will send other patch.

Thanks,
>>   		goto failed_free;
>>   	}
>>   
>> -- 
>> 2.7.4
>>
> Thanks.
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-11-20 16:24 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-18 10:55 [PATCH 01/10 v3] Input: ep93xx_keypad: Fix platform_get_irq's error checking Arvind Yadav
2017-11-18 10:55 ` [PATCH 02/10 v3] Input: omap4-keypad: " Arvind Yadav
2017-11-18 10:55 ` [PATCH 03/10 v3] Input: twl4030_keypad: " Arvind Yadav
2017-11-18 10:55 ` [PATCH 04/10 v3] Input: serio: " Arvind Yadav
2017-11-18 10:55 ` [PATCH 05/10 v3] Input: cpcap-pwrbutton: Handle return value of platform_get_irq Arvind Yadav
     [not found] ` <76d6a73ba51e1a8a86d8d9a1d0bbbf7723d5153a.1510999334.git.arvind.yadav.cs@gmail.com>
2017-11-18 10:55   ` [PATCH 06/10 v2] Input: w90p910_ts: " Arvind Yadav
2017-11-18 10:55   ` [PATCH 08/10 v3] Input: twl4030-pwrbutton: " Arvind Yadav
2017-11-18 10:55   ` [PATCH 09/10 v2] Input: sirfsoc-onkey: " Arvind Yadav
2017-11-18 10:55   ` [PATCH 10/10 v2] Input: palmas-pwrbutton: " Arvind Yadav
2017-11-18 10:55 ` [PATCH 07/10 v3] Input: sun4i-ts: " Arvind Yadav
2017-11-18 18:30 ` [PATCH 01/10 v3] Input: ep93xx_keypad: Fix platform_get_irq's error checking Dmitry Torokhov
2017-11-20 16:24   ` arvindY

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).