All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Maxime Ripard <mripard@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
	linux-input@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 4/4] Input: sun4i-ps2 - Fix handling of platform_get_irq() error
Date: Wed, 16 Sep 2020 08:08:36 +0200	[thread overview]
Message-ID: <CAJKOXPesf1mnt_QC59Bgt27r4Ntu4vowBQCvexmRkASVhuPLEw@mail.gmail.com> (raw)
In-Reply-To: <20200916010140.GG1681290@dtor-ws>

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

WARNING: multiple messages have this Message-ID (diff)
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Chen-Yu Tsai <wens@csie.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Maxime Ripard <mripard@kernel.org>,
	linux-input@vger.kernel.org
Subject: Re: [PATCH v2 4/4] Input: sun4i-ps2 - Fix handling of platform_get_irq() error
Date: Wed, 16 Sep 2020 08:08:36 +0200	[thread overview]
Message-ID: <CAJKOXPesf1mnt_QC59Bgt27r4Ntu4vowBQCvexmRkASVhuPLEw@mail.gmail.com> (raw)
In-Reply-To: <20200916010140.GG1681290@dtor-ws>

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-09-16  6:08 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-08-28 14:57 ` [PATCH v2 2/4] Input: omap4-keypad " Krzysztof Kozlowski
2020-08-28 14:57   ` Krzysztof Kozlowski
2020-09-16  0:53   ` Dmitry Torokhov
2020-09-16  0:53     ` Dmitry Torokhov
2020-09-16  6:06     ` Krzysztof Kozlowski
2020-09-16  6:06       ` Krzysztof Kozlowski
2020-09-16  6:25       ` Dmitry Torokhov
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   ` Krzysztof Kozlowski
2020-08-28 14:57 ` [PATCH v2 4/4] Input: sun4i-ps2 " Krzysztof Kozlowski
2020-08-28 14:57   ` Krzysztof Kozlowski
2020-08-28 15:34   ` Chen-Yu Tsai
2020-08-28 15:34     ` Chen-Yu Tsai
2020-09-16  1:01   ` Dmitry Torokhov
2020-09-16  1:01     ` Dmitry Torokhov
2020-09-16  6:08     ` Krzysztof Kozlowski [this message]
2020-09-16  6:08       ` Krzysztof Kozlowski
2020-09-11 15:31 ` [PATCH v2 1/4] Input: ep93xx_keypad " Krzysztof Kozlowski
2020-09-11 15:31   ` Krzysztof Kozlowski
2020-09-14  6:51 ` Dmitry Torokhov
2020-09-14  6:51   ` Dmitry Torokhov
2020-09-15 16:05   ` Krzysztof Kozlowski
2020-09-15 16:05     ` Krzysztof Kozlowski
2020-09-16  0:55     ` Dmitry Torokhov
2020-09-16  0:55       ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJKOXPesf1mnt_QC59Bgt27r4Ntu4vowBQCvexmRkASVhuPLEw@mail.gmail.com \
    --to=krzk@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.