public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] gpiolib: fix gpiochip_machine_hog()
@ 2018-05-01  7:36 Dan Carpenter
  2018-05-02  8:47 ` Bartosz Golaszewski
  2018-05-04 16:08 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2018-05-01  7:36 UTC (permalink / raw)
  To: kernel-janitors

There is a shifter vs vanilla mask bug here.  We want to test if 1 << 11
is set but we're testing if 0xb is set.

Fixes: 9a6c505f7df1 ("gpiolib: add hogs support for machine code")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 2716c9e65131..c6cb63e43eda 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1187,7 +1187,7 @@ static void gpiochip_machine_hog(struct gpio_chip *chip, struct gpiod_hog *hog)
 		return;
 	}
 
-	if (desc->flags & FLAG_IS_HOGGED)
+	if (test_bit(FLAG_IS_HOGGED, &desc->flags))
 		return;
 
 	rv = gpiod_hog(desc, hog->line_name, hog->lflags, hog->dflags);

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

* Re: [patch] gpiolib: fix gpiochip_machine_hog()
  2018-05-01  7:36 [patch] gpiolib: fix gpiochip_machine_hog() Dan Carpenter
@ 2018-05-02  8:47 ` Bartosz Golaszewski
  2018-05-04 16:08 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2018-05-02  8:47 UTC (permalink / raw)
  To: kernel-janitors

2018-05-01 9:36 GMT+02:00 Dan Carpenter <dan.carpenter@oracle.com>:
> There is a shifter vs vanilla mask bug here.  We want to test if 1 << 11
> is set but we're testing if 0xb is set.
>
> Fixes: 9a6c505f7df1 ("gpiolib: add hogs support for machine code")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 2716c9e65131..c6cb63e43eda 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -1187,7 +1187,7 @@ static void gpiochip_machine_hog(struct gpio_chip *chip, struct gpiod_hog *hog)
>                 return;
>         }
>
> -       if (desc->flags & FLAG_IS_HOGGED)
> +       if (test_bit(FLAG_IS_HOGGED, &desc->flags))
>                 return;
>
>         rv = gpiod_hog(desc, hog->line_name, hog->lflags, hog->dflags);

Thanks for catching it!

Reviewed-by: Bartosz Golaszewski <brgl@bgdev.pl>

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

* Re: [patch] gpiolib: fix gpiochip_machine_hog()
  2018-05-01  7:36 [patch] gpiolib: fix gpiochip_machine_hog() Dan Carpenter
  2018-05-02  8:47 ` Bartosz Golaszewski
@ 2018-05-04 16:08 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2018-05-04 16:08 UTC (permalink / raw)
  To: kernel-janitors

On Tue, May 1, 2018 at 9:36 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:

> There is a shifter vs vanilla mask bug here.  We want to test if 1 << 11
> is set but we're testing if 0xb is set.
>
> Fixes: 9a6c505f7df1 ("gpiolib: add hogs support for machine code")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Patch applied with Bartosz review tag.

Yours,
Linus Walleij

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

end of thread, other threads:[~2018-05-04 16:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-01  7:36 [patch] gpiolib: fix gpiochip_machine_hog() Dan Carpenter
2018-05-02  8:47 ` Bartosz Golaszewski
2018-05-04 16:08 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox