linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3 v2] Input: omap4-keypad: Fix platform_get_irq's error checking
@ 2017-11-17 20:58 Arvind Yadav
  2017-11-17 20:58 ` [PATCH 2/3 v2] Input: twl4030_keypad: " Arvind Yadav
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Arvind Yadav @ 2017-11-17 20:58 UTC (permalink / raw)
  To: 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 ib v2 :
               Return error(irq) insted of -EINVAL.

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

* [PATCH 2/3 v2] Input: twl4030_keypad: Fix platform_get_irq's error checking
  2017-11-17 20:58 [PATCH 1/3 v2] Input: omap4-keypad: Fix platform_get_irq's error checking Arvind Yadav
@ 2017-11-17 20:58 ` Arvind Yadav
  2017-11-18  8:20   ` Russell King - ARM Linux
  2017-11-17 20:58 ` [PATCH 4/10 v2] Input: serio: " Arvind Yadav
  2017-11-18  8:20 ` [PATCH 1/3 v2] Input: omap4-keypad: " Russell King - ARM Linux
  2 siblings, 1 reply; 6+ messages in thread
From: Arvind Yadav @ 2017-11-17 20:58 UTC (permalink / raw)
  To: 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.

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

* [PATCH 4/10 v2] Input: serio: Fix platform_get_irq's error checking
  2017-11-17 20:58 [PATCH 1/3 v2] Input: omap4-keypad: Fix platform_get_irq's error checking Arvind Yadav
  2017-11-17 20:58 ` [PATCH 2/3 v2] Input: twl4030_keypad: " Arvind Yadav
@ 2017-11-17 20:58 ` Arvind Yadav
  2017-11-18  8:20   ` Russell King - ARM Linux
  2017-11-18  8:20 ` [PATCH 1/3 v2] Input: omap4-keypad: " Russell King - ARM Linux
  2 siblings, 1 reply; 6+ messages in thread
From: Arvind Yadav @ 2017-11-17 20:58 UTC (permalink / raw)
  To: 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.

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

* [PATCH 1/3 v2] Input: omap4-keypad: Fix platform_get_irq's error checking
  2017-11-17 20:58 [PATCH 1/3 v2] Input: omap4-keypad: Fix platform_get_irq's error checking Arvind Yadav
  2017-11-17 20:58 ` [PATCH 2/3 v2] Input: twl4030_keypad: " Arvind Yadav
  2017-11-17 20:58 ` [PATCH 4/10 v2] Input: serio: " Arvind Yadav
@ 2017-11-18  8:20 ` Russell King - ARM Linux
  2 siblings, 0 replies; 6+ messages in thread
From: Russell King - ARM Linux @ 2017-11-18  8:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Nov 18, 2017 at 02:28:48AM +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.

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@8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

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

* [PATCH 2/3 v2] Input: twl4030_keypad: Fix platform_get_irq's error checking
  2017-11-17 20:58 ` [PATCH 2/3 v2] Input: twl4030_keypad: " Arvind Yadav
@ 2017-11-18  8:20   ` Russell King - ARM Linux
  0 siblings, 0 replies; 6+ messages in thread
From: Russell King - ARM Linux @ 2017-11-18  8:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Nov 18, 2017 at 02:28:49AM +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.

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@8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

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

* [PATCH 4/10 v2] Input: serio: Fix platform_get_irq's error checking
  2017-11-17 20:58 ` [PATCH 4/10 v2] Input: serio: " Arvind Yadav
@ 2017-11-18  8:20   ` Russell King - ARM Linux
  0 siblings, 0 replies; 6+ messages in thread
From: Russell King - ARM Linux @ 2017-11-18  8:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Nov 18, 2017 at 02:28:50AM +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

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@8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

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

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-17 20:58 [PATCH 1/3 v2] Input: omap4-keypad: Fix platform_get_irq's error checking Arvind Yadav
2017-11-17 20:58 ` [PATCH 2/3 v2] Input: twl4030_keypad: " Arvind Yadav
2017-11-18  8:20   ` Russell King - ARM Linux
2017-11-17 20:58 ` [PATCH 4/10 v2] Input: serio: " Arvind Yadav
2017-11-18  8:20   ` Russell King - ARM Linux
2017-11-18  8:20 ` [PATCH 1/3 v2] Input: omap4-keypad: " 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).