Message ID | 20180501073638.GA6126@mwanda |
---|---|
State | New |
Headers | show |
Series | gpiolib: fix gpiochip_machine_hog() | expand |
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> -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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);
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> -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html