From 76590b1e882f4c275df695ae0641fb2d059cd9c3 Mon Sep 17 00:00:00 2001 From: Bill Pemberton Date: Fri, 16 Jan 2015 13:57:32 -0500 Subject: [PATCH] greybus: gpio-gb: remove checks for negative offset variable offset is defined as unsigned so there is no point checking for negative values of offset. Signed-off-by: Bill Pemberton Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/gpio-gb.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/greybus/gpio-gb.c b/drivers/staging/greybus/gpio-gb.c index 5fcd01814126..4997588e2617 100644 --- a/drivers/staging/greybus/gpio-gb.c +++ b/drivers/staging/greybus/gpio-gb.c @@ -312,7 +312,7 @@ static int gb_gpio_request(struct gpio_chip *chip, unsigned offset) struct gb_gpio_controller *gb_gpio_controller = gpio_chip_to_gb_gpio_controller(chip); int ret; - if (offset < 0 || offset >= chip->ngpio) + if (offset >= chip->ngpio) return -EINVAL; ret = gb_gpio_activate_operation(gb_gpio_controller, (u8)offset); if (ret) @@ -325,7 +325,7 @@ static void gb_gpio_free(struct gpio_chip *chip, unsigned offset) struct gb_gpio_controller *gb_gpio_controller = gpio_chip_to_gb_gpio_controller(chip); int ret; - if (offset < 0 || offset >= chip->ngpio) { + if (offset >= chip->ngpio) { pr_err("bad offset %u supplied (must be 0..%u)\n", offset, chip->ngpio - 1); return; @@ -341,7 +341,7 @@ static int gb_gpio_get_direction(struct gpio_chip *chip, unsigned offset) u8 which; int ret; - if (offset < 0 || offset >= chip->ngpio) + if (offset >= chip->ngpio) return -EINVAL; which = (u8)offset; ret = gb_gpio_get_direction_operation(gb_gpio_controller, which); @@ -355,7 +355,7 @@ static int gb_gpio_direction_input(struct gpio_chip *chip, unsigned offset) struct gb_gpio_controller *gb_gpio_controller = gpio_chip_to_gb_gpio_controller(chip); int ret; - if (offset < 0 || offset >= chip->ngpio) + if (offset >= chip->ngpio) return -EINVAL; ret = gb_gpio_direction_in_operation(gb_gpio_controller, (u8)offset); if (ret) @@ -369,7 +369,7 @@ static int gb_gpio_direction_output(struct gpio_chip *chip, unsigned offset, struct gb_gpio_controller *gb_gpio_controller = gpio_chip_to_gb_gpio_controller(chip); int ret; - if (offset < 0 || offset >= chip->ngpio) + if (offset >= chip->ngpio) return -EINVAL; ret = gb_gpio_direction_out_operation(gb_gpio_controller, (u8)offset, !!value); if (ret) @@ -383,7 +383,7 @@ static int gb_gpio_get(struct gpio_chip *chip, unsigned offset) u8 which; int ret; - if (offset < 0 || offset >= chip->ngpio) + if (offset >= chip->ngpio) return -EINVAL; which = (u8)offset; ret = gb_gpio_get_value_operation(gb_gpio_controller, which); @@ -414,7 +414,7 @@ static int gb_gpio_set_debounce(struct gpio_chip *chip, unsigned offset, u16 usec; int ret; - if (offset < 0 || offset >= chip->ngpio) + if (offset >= chip->ngpio) return -EINVAL; if (debounce > (unsigned int)U16_MAX) return -EINVAL; @@ -428,7 +428,7 @@ static int gb_gpio_set_debounce(struct gpio_chip *chip, unsigned offset, static int gb_gpio_to_irq(struct gpio_chip *chip, unsigned offset) { - if (offset < 0 || offset >= chip->ngpio) + if (offset >= chip->ngpio) return -EINVAL; return 0; /* XXX */ -- 2.39.5