Message ID | 20200828145744.3636-2-krzk@kernel.org |
---|---|
State | Superseded |
Headers | show |
Series | None | expand |
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
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
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.
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) {
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(-)