diff options
author | Johan Hovold <johan@hovoldconsulting.com> | 2015-03-19 16:51:09 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <greg@kroah.com> | 2015-03-19 17:29:40 +0100 |
commit | c2a66106867343b5c5f017ccc724ba1c1aa9b540 (patch) | |
tree | 75e7551139354e056c364cfd1e7bc68333d02a38 /drivers/staging/greybus/gpio.c | |
parent | c0d209a07beb3550203bfa237d27433a1fbc9cee (diff) |
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: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'drivers/staging/greybus/gpio.c')
-rw-r--r-- | drivers/staging/greybus/gpio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c index 458565a7afb8..f75dd40033af 100644 --- a/drivers/staging/greybus/gpio.c +++ b/drivers/staging/greybus/gpio.c @@ -543,9 +543,9 @@ static int gb_gpio_set_debounce(struct gpio_chip *chip, unsigned offset, if (offset >= chip->ngpio) return -EINVAL; - if (debounce > (unsigned int)U16_MAX) + if (debounce > U16_MAX) return -EINVAL; - usec = (u8)debounce; + usec = (u16)debounce; ret = gb_gpio_set_debounce_operation(gb_gpio_controller, (u8)offset, usec); if (ret) ; /* return ret; */ |