Commit c2a66106 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

greybus: gpio: fix truncated debounce times

Fix set_debounce, which silently truncated the time argument to 255us
even though we support 16-bit values.

Also remove the unnecessary explicit cast when verifying the argument.
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent c0d209a0
...@@ -543,9 +543,9 @@ static int gb_gpio_set_debounce(struct gpio_chip *chip, unsigned offset, ...@@ -543,9 +543,9 @@ static int gb_gpio_set_debounce(struct gpio_chip *chip, unsigned offset,
if (offset >= chip->ngpio) if (offset >= chip->ngpio)
return -EINVAL; return -EINVAL;
if (debounce > (unsigned int)U16_MAX) if (debounce > U16_MAX)
return -EINVAL; return -EINVAL;
usec = (u8)debounce; usec = (u16)debounce;
ret = gb_gpio_set_debounce_operation(gb_gpio_controller, (u8)offset, usec); ret = gb_gpio_set_debounce_operation(gb_gpio_controller, (u8)offset, usec);
if (ret) if (ret)
; /* return ret; */ ; /* return ret; */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment