linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error
@ 2020-08-28 14:57 Krzysztof Kozlowski
  2020-08-28 14:57 ` [PATCH v2 2/4] Input: omap4-keypad " Krzysztof Kozlowski
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-28 14:57 UTC (permalink / raw)
  To: Dmitry Torokhov, Maxime Ripard, Chen-Yu Tsai,
	Krzysztof Kozlowski, 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>

---

Changes since v1:
1. None
---
 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] 14+ messages in thread

* [PATCH v2 2/4] Input: omap4-keypad - Fix handling of platform_get_irq() error
  2020-08-28 14:57 [PATCH v2 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error Krzysztof Kozlowski
@ 2020-08-28 14:57 ` Krzysztof Kozlowski
  2020-09-16  0:53   ` Dmitry Torokhov
  2020-08-28 14:57 ` [PATCH v2 3/4] Input: twl4030_keypad " Krzysztof Kozlowski
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-28 14:57 UTC (permalink / raw)
  To: Dmitry Torokhov, Maxime Ripard, Chen-Yu Tsai,
	Krzysztof Kozlowski, 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>

---

Changes since v1:
1. None
---
 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] 14+ messages in thread

* [PATCH v2 3/4] Input: twl4030_keypad - Fix handling of platform_get_irq() error
  2020-08-28 14:57 [PATCH v2 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error Krzysztof Kozlowski
  2020-08-28 14:57 ` [PATCH v2 2/4] Input: omap4-keypad " Krzysztof Kozlowski
@ 2020-08-28 14:57 ` Krzysztof Kozlowski
  2020-08-28 14:57 ` [PATCH v2 4/4] Input: sun4i-ps2 " Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-28 14:57 UTC (permalink / raw)
  To: Dmitry Torokhov, Maxime Ripard, Chen-Yu Tsai,
	Krzysztof Kozlowski, linux-input, linux-kernel, linux-arm-kernel

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

Fixes: 7abf38d6d13c ("Input: twl4030-keypad - add device tree support")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

---

Changes since v1:
1. Fix also casting return value to unsigned.
---
 drivers/input/keyboard/twl4030_keypad.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
index af3a6824f1a4..77e0743a3cf8 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -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;
@@ -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] 14+ messages in thread

* [PATCH v2 4/4] Input: sun4i-ps2 - Fix handling of platform_get_irq() error
  2020-08-28 14:57 [PATCH v2 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error Krzysztof Kozlowski
  2020-08-28 14:57 ` [PATCH v2 2/4] Input: omap4-keypad " Krzysztof Kozlowski
  2020-08-28 14:57 ` [PATCH v2 3/4] Input: twl4030_keypad " Krzysztof Kozlowski
@ 2020-08-28 14:57 ` Krzysztof Kozlowski
  2020-08-28 15:34   ` Chen-Yu Tsai
  2020-09-16  1:01   ` Dmitry Torokhov
  2020-09-11 15:31 ` [PATCH v2 1/4] Input: ep93xx_keypad " Krzysztof Kozlowski
  2020-09-14  6:51 ` Dmitry Torokhov
  4 siblings, 2 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-28 14:57 UTC (permalink / raw)
  To: Dmitry Torokhov, Maxime Ripard, Chen-Yu Tsai,
	Krzysztof Kozlowski, 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>

---

Changes since v1:
1. None
---
 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] 14+ messages in thread

* Re: [PATCH v2 4/4] Input: sun4i-ps2 - Fix handling of platform_get_irq() error
  2020-08-28 14:57 ` [PATCH v2 4/4] Input: sun4i-ps2 " Krzysztof Kozlowski
@ 2020-08-28 15:34   ` Chen-Yu Tsai
  2020-09-16  1:01   ` Dmitry Torokhov
  1 sibling, 0 replies; 14+ messages in thread
From: Chen-Yu Tsai @ 2020-08-28 15:34 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Maxime Ripard, linux-input, linux-kernel,
	linux-arm-kernel

On Fri, Aug 28, 2020 at 10:58 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> 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>

Acked-by: Chen-Yu Tsai <wens@csie.org>

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

* Re: [PATCH v2 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error
  2020-08-28 14:57 [PATCH v2 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2020-08-28 14:57 ` [PATCH v2 4/4] Input: sun4i-ps2 " Krzysztof Kozlowski
@ 2020-09-11 15:31 ` Krzysztof Kozlowski
  2020-09-14  6:51 ` Dmitry Torokhov
  4 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2020-09-11 15:31 UTC (permalink / raw)
  To: Dmitry Torokhov, Maxime Ripard, Chen-Yu Tsai, linux-input,
	linux-kernel, linux-arm-kernel

On Fri, Aug 28, 2020 at 04:57:41PM +0200, Krzysztof Kozlowski wrote:
> 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>
> 
> ---
> 
> Changes since v1:
> 1. None
> ---
>  drivers/input/keyboard/ep93xx_keypad.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Hi Dmitry,

Any comments on the series?

Best regards,
Krzysztof


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

* Re: [PATCH v2 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error
  2020-08-28 14:57 [PATCH v2 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error Krzysztof Kozlowski
                   ` (3 preceding siblings ...)
  2020-09-11 15:31 ` [PATCH v2 1/4] Input: ep93xx_keypad " Krzysztof Kozlowski
@ 2020-09-14  6:51 ` Dmitry Torokhov
  2020-09-15 16:05   ` Krzysztof Kozlowski
  4 siblings, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2020-09-14  6:51 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Maxime Ripard, Chen-Yu Tsai, linux-input, linux-kernel, linux-arm-kernel

Hi Krzysztof,

On Fri, Aug 28, 2020 at 04:57:41PM +0200, Krzysztof Kozlowski wrote:
> platform_get_irq() returns -ERRNO on error.  In such case comparison
> to 0 would pass the check.

platform_get_irq() is a bit of a mess. Historically we allowed defining
interrupt resource with r->start == 0 and for such cases non-OF non-ACPI
code will return 0 from platform_get_irq() to indicate that IRQ is not
assigned.

We either need to stop doing this in platform_get_irq(), or the
conditions in this patch and followups should be "irq <= 0" and we need
to make sure we do not accidentally return 0 from probe ...

Thanks.

-- 
Dmitry

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

* Re: [PATCH v2 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error
  2020-09-14  6:51 ` Dmitry Torokhov
@ 2020-09-15 16:05   ` Krzysztof Kozlowski
  2020-09-16  0:55     ` Dmitry Torokhov
  0 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2020-09-15 16:05 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Maxime Ripard, Chen-Yu Tsai, linux-input, linux-kernel, linux-arm-kernel

On Mon, 14 Sep 2020 at 08:51, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
>
> Hi Krzysztof,
>
> On Fri, Aug 28, 2020 at 04:57:41PM +0200, Krzysztof Kozlowski wrote:
> > platform_get_irq() returns -ERRNO on error.  In such case comparison
> > to 0 would pass the check.
>
> platform_get_irq() is a bit of a mess. Historically we allowed defining
> interrupt resource with r->start == 0 and for such cases non-OF non-ACPI
> code will return 0 from platform_get_irq() to indicate that IRQ is not
> assigned.
>
> We either need to stop doing this in platform_get_irq(), or the
> conditions in this patch and followups should be "irq <= 0" and we need
> to make sure we do not accidentally return 0 from probe ...

Hi,

It's then contradictory to platform_get_irq documentation which
explicitly says - zero will not be returned on error. This was also
clarified in commit e330b9a6bb35 ("platform: don't return 0 from
platform_get_irq[_byname]() on error").

As I understood the input drivers code, they check for errors so the
coe in my patch is correct. Any "<=0" is not correct with current
documentation and implementation.

Best regards,
Krzysztof

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

* Re: [PATCH v2 2/4] Input: omap4-keypad - Fix handling of platform_get_irq() error
  2020-08-28 14:57 ` [PATCH v2 2/4] Input: omap4-keypad " Krzysztof Kozlowski
@ 2020-09-16  0:53   ` Dmitry Torokhov
  2020-09-16  6:06     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2020-09-16  0:53 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Maxime Ripard, Chen-Yu Tsai, linux-input, linux-kernel, linux-arm-kernel

On Fri, Aug 28, 2020 at 04:57:42PM +0200, Krzysztof Kozlowski wrote:
> 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>
> 
> ---
> 
> Changes since v1:
> 1. None
> ---
>  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;

You must have meant just "irq", right?

>  
>  	keypad_data = kzalloc(sizeof(struct omap4_keypad), GFP_KERNEL);
>  	if (!keypad_data) {
> -- 
> 2.17.1
> 

-- 
Dmitry

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

* Re: [PATCH v2 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error
  2020-09-15 16:05   ` Krzysztof Kozlowski
@ 2020-09-16  0:55     ` Dmitry Torokhov
  0 siblings, 0 replies; 14+ messages in thread
From: Dmitry Torokhov @ 2020-09-16  0:55 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Maxime Ripard, Chen-Yu Tsai, linux-input, linux-kernel, linux-arm-kernel

On Tue, Sep 15, 2020 at 06:05:22PM +0200, Krzysztof Kozlowski wrote:
> On Mon, 14 Sep 2020 at 08:51, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> >
> > Hi Krzysztof,
> >
> > On Fri, Aug 28, 2020 at 04:57:41PM +0200, Krzysztof Kozlowski wrote:
> > > platform_get_irq() returns -ERRNO on error.  In such case comparison
> > > to 0 would pass the check.
> >
> > platform_get_irq() is a bit of a mess. Historically we allowed defining
> > interrupt resource with r->start == 0 and for such cases non-OF non-ACPI
> > code will return 0 from platform_get_irq() to indicate that IRQ is not
> > assigned.
> >
> > We either need to stop doing this in platform_get_irq(), or the
> > conditions in this patch and followups should be "irq <= 0" and we need
> > to make sure we do not accidentally return 0 from probe ...
> 
> Hi,
> 
> It's then contradictory to platform_get_irq documentation which
> explicitly says - zero will not be returned on error. This was also
> clarified in commit e330b9a6bb35 ("platform: don't return 0 from
> platform_get_irq[_byname]() on error").

It was for OF/ACPI, but not for resources described via DEFINE_RES_IRQ
or other means. However I see we added a big fat WARN_ON() in case if we
end up returning 0 still, so I will be applying your patches.

Thanks.

-- 
Dmitry

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

* Re: [PATCH v2 4/4] Input: sun4i-ps2 - Fix handling of platform_get_irq() error
  2020-08-28 14:57 ` [PATCH v2 4/4] Input: sun4i-ps2 " Krzysztof Kozlowski
  2020-08-28 15:34   ` Chen-Yu Tsai
@ 2020-09-16  1:01   ` Dmitry Torokhov
  2020-09-16  6:08     ` Krzysztof Kozlowski
  1 sibling, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2020-09-16  1:01 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Maxime Ripard, Chen-Yu Tsai, linux-input, linux-kernel, linux-arm-kernel

On Fri, Aug 28, 2020 at 04:57:44PM +0200, Krzysztof Kozlowski wrote:
> 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>
> 
> ---
> 
> Changes since v1:
> 1. None
> ---
>  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) {

"irq" is unsigned here, so this will not work. I'll change it to use
drvdat->irq which happens to be signed, and drop "irq" variable.

> +		error = irq;
>  		goto err_disable_clk;
>  	}
>  
> -- 
> 2.17.1
> 

Thanks.

-- 
Dmitry

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

* Re: [PATCH v2 2/4] Input: omap4-keypad - Fix handling of platform_get_irq() error
  2020-09-16  0:53   ` Dmitry Torokhov
@ 2020-09-16  6:06     ` Krzysztof Kozlowski
  2020-09-16  6:25       ` Dmitry Torokhov
  0 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2020-09-16  6:06 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Maxime Ripard, Chen-Yu Tsai, linux-input, linux-kernel, linux-arm-kernel

On Wed, 16 Sep 2020 at 02:54, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
>
> On Fri, Aug 28, 2020 at 04:57:42PM +0200, Krzysztof Kozlowski wrote:
> > 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>
> >
> > ---
> >
> > Changes since v1:
> > 1. None
> > ---
> >  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;
>
> You must have meant just "irq", right?

Damn it, of course. I'll send a v2 for this.

Best regards,
Krzysztof

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

* Re: [PATCH v2 4/4] Input: sun4i-ps2 - Fix handling of platform_get_irq() error
  2020-09-16  1:01   ` Dmitry Torokhov
@ 2020-09-16  6:08     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2020-09-16  6:08 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Maxime Ripard, Chen-Yu Tsai, linux-input, linux-kernel, linux-arm-kernel

On Wed, 16 Sep 2020 at 03:01, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
>
> On Fri, Aug 28, 2020 at 04:57:44PM +0200, Krzysztof Kozlowski wrote:
> > 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>
> >
> > ---
> >
> > Changes since v1:
> > 1. None
> > ---
> >  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) {
>
> "irq" is unsigned here, so this will not work. I'll change it to use
> drvdat->irq which happens to be signed, and drop "irq" variable.

Yes, thanks. I wonder now why there was no warning of unsigned<0 comparison.

Best regards,
Krzysztof

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

* Re: [PATCH v2 2/4] Input: omap4-keypad - Fix handling of platform_get_irq() error
  2020-09-16  6:06     ` Krzysztof Kozlowski
@ 2020-09-16  6:25       ` Dmitry Torokhov
  0 siblings, 0 replies; 14+ messages in thread
From: Dmitry Torokhov @ 2020-09-16  6:25 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Maxime Ripard, Chen-Yu Tsai, linux-input, linux-kernel, linux-arm-kernel

On Tue, Sep 15, 2020 at 11:06 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On Wed, 16 Sep 2020 at 02:54, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> >
> > On Fri, Aug 28, 2020 at 04:57:42PM +0200, Krzysztof Kozlowski wrote:
> > > 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>
> > >
> > > ---
> > >
> > > Changes since v1:
> > > 1. None
> > > ---
> > >  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;
> >
> > You must have meant just "irq", right?
>
> Damn it, of course. I'll send a v2 for this.

It's fine, I can fix it up locally.

Thanks.

-- 
Dmitry

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

end of thread, other threads:[~2020-09-16  6:26 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28 14:57 [PATCH v2 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error Krzysztof Kozlowski
2020-08-28 14:57 ` [PATCH v2 2/4] Input: omap4-keypad " Krzysztof Kozlowski
2020-09-16  0:53   ` Dmitry Torokhov
2020-09-16  6:06     ` Krzysztof Kozlowski
2020-09-16  6:25       ` Dmitry Torokhov
2020-08-28 14:57 ` [PATCH v2 3/4] Input: twl4030_keypad " Krzysztof Kozlowski
2020-08-28 14:57 ` [PATCH v2 4/4] Input: sun4i-ps2 " Krzysztof Kozlowski
2020-08-28 15:34   ` Chen-Yu Tsai
2020-09-16  1:01   ` Dmitry Torokhov
2020-09-16  6:08     ` Krzysztof Kozlowski
2020-09-11 15:31 ` [PATCH v2 1/4] Input: ep93xx_keypad " Krzysztof Kozlowski
2020-09-14  6:51 ` Dmitry Torokhov
2020-09-15 16:05   ` Krzysztof Kozlowski
2020-09-16  0:55     ` Dmitry Torokhov

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