Commit 76590b1e authored by Bill Pemberton's avatar Bill Pemberton Committed by Greg Kroah-Hartman

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: default avatarBill Pemberton <wfp5p@worldbroken.com>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 9d677cf6
......@@ -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 */
......
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