* [PATCH] gpio: rc5t583: Remove redundant check
@ 2014-02-15 13:24 Alexander Shiyan
2014-02-24 13:52 ` Linus Walleij
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Shiyan @ 2014-02-15 13:24 UTC (permalink / raw)
To: linux-gpio; +Cc: Linus Walleij, Alexandre Courbot, Alexander Shiyan
Variable "offset" cannot be negative, so no need to check if it
greater than zero or equal.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
drivers/gpio/gpio-rc5t583.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-rc5t583.c b/drivers/gpio/gpio-rc5t583.c
index 122b776..9b42317 100644
--- a/drivers/gpio/gpio-rc5t583.c
+++ b/drivers/gpio/gpio-rc5t583.c
@@ -97,7 +97,7 @@ static int rc5t583_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
{
struct rc5t583_gpio *rc5t583_gpio = to_rc5t583_gpio(gc);
- if ((offset >= 0) && (offset < 8))
+ if (offset < RC5T583_MAX_GPIO)
return rc5t583_gpio->rc5t583->irq_base +
RC5T583_IRQ_GPIO0 + offset;
return -EINVAL;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: rc5t583: Remove redundant check
2014-02-15 13:24 [PATCH] gpio: rc5t583: Remove redundant check Alexander Shiyan
@ 2014-02-24 13:52 ` Linus Walleij
2014-02-24 14:20 ` Alexander Shiyan
0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2014-02-24 13:52 UTC (permalink / raw)
To: Alexander Shiyan; +Cc: linux-gpio@vger.kernel.org, Alexandre Courbot
On Sat, Feb 15, 2014 at 2:24 PM, Alexander Shiyan <shc_work@mail.ru> wrote:
> Variable "offset" cannot be negative, so no need to check if it
> greater than zero or equal.
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Patch applied.
Nice patches by the way, are you finding these by using some
static code checking tool?
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: rc5t583: Remove redundant check
2014-02-24 13:52 ` Linus Walleij
@ 2014-02-24 14:20 ` Alexander Shiyan
0 siblings, 0 replies; 3+ messages in thread
From: Alexander Shiyan @ 2014-02-24 14:20 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio@vger.kernel.org, Alexandre Courbot
Понедельник, 24 февраля 2014, 14:52 +01:00 от Linus Walleij <linus.walleij@linaro.org>:
> On Sat, Feb 15, 2014 at 2:24 PM, Alexander Shiyan <shc_work@mail.ru> wrote:
>
> > Variable "offset" cannot be negative, so no need to check if it
> > greater than zero or equal.
> >
> > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
>
> Patch applied.
>
> Nice patches by the way, are you finding these by using some
> static code checking tool?
Yes, it is found using cppcheck tool.
---
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-24 14:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-15 13:24 [PATCH] gpio: rc5t583: Remove redundant check Alexander Shiyan
2014-02-24 13:52 ` Linus Walleij
2014-02-24 14:20 ` Alexander Shiyan
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).