diff mbox series

[v1,1/1] gpiolib: Drop duplicate offset check in gpiochip_is_requested()

Message ID 20210510195221.12350-1-andriy.shevchenko@linux.intel.com
State New
Headers show
Series [v1,1/1] gpiolib: Drop duplicate offset check in gpiochip_is_requested() | expand

Commit Message

Andy Shevchenko May 10, 2021, 7:52 p.m. UTC
gpiochip_get_desc() already does the check, drop a duplicate in
gpiochip_is_requested().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpiolib.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Linus Walleij May 19, 2021, 11:32 p.m. UTC | #1
On Mon, May 10, 2021 at 9:52 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> gpiochip_get_desc() already does the check, drop a duplicate in
> gpiochip_is_requested().
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Bartosz Golaszewski May 21, 2021, 12:51 p.m. UTC | #2
On Mon, May 10, 2021 at 9:52 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> gpiochip_get_desc() already does the check, drop a duplicate in
> gpiochip_is_requested().
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/gpiolib.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 1427c1be749b..220a9d8dd4e3 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -2004,9 +2004,6 @@ const char *gpiochip_is_requested(struct gpio_chip *gc, unsigned int offset)
>  {
>         struct gpio_desc *desc;
>
> -       if (offset >= gc->ngpio)
> -               return NULL;
> -
>         desc = gpiochip_get_desc(gc, offset);
>         if (IS_ERR(desc))
>                 return NULL;
> --
> 2.30.2
>

I applied this some time ago just forgot to comment here.

Bart
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 1427c1be749b..220a9d8dd4e3 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2004,9 +2004,6 @@  const char *gpiochip_is_requested(struct gpio_chip *gc, unsigned int offset)
 {
 	struct gpio_desc *desc;
 
-	if (offset >= gc->ngpio)
-		return NULL;
-
 	desc = gpiochip_get_desc(gc, offset);
 	if (IS_ERR(desc))
 		return NULL;