]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
greybus: gpio: fix truncated debounce times
authorJohan Hovold <johan@hovoldconsulting.com>
Thu, 19 Mar 2015 15:51:09 +0000 (16:51 +0100)
committerGreg Kroah-Hartman <greg@kroah.com>
Thu, 19 Mar 2015 16:29:40 +0000 (17:29 +0100)
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>
drivers/staging/greybus/gpio.c

index 458565a7afb8dea967769974b3be0edacb6d0b4f..f75dd40033af7861b9d31997940acce27918f84d 100644 (file)
@@ -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; */