Skip to content

Commit

Permalink
gpio: altera-a10sr: Trivial coding style fix
Browse files Browse the repository at this point in the history
Change the coding style to make it does error checking first.
This also fixes checkpatch warning about line over 80 characters.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested by: Thor Thayer <thor.thayer@linux.intel.com>
Reviewed by: Thor Thayer <thor.thayer@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
  • Loading branch information
Axel Lin authored and Bartosz Golaszewski committed Feb 14, 2019
1 parent 6911845 commit 68b7587
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions drivers/gpio/gpio-altera-a10sr.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,20 @@ static void altr_a10sr_gpio_set(struct gpio_chip *chip, unsigned int offset,
static int altr_a10sr_gpio_direction_input(struct gpio_chip *gc,
unsigned int nr)
{
if (nr >= (ALTR_A10SR_IN_VALID_RANGE_LO - ALTR_A10SR_LED_VALID_SHIFT))
return 0;
return -EINVAL;
if (nr < (ALTR_A10SR_IN_VALID_RANGE_LO - ALTR_A10SR_LED_VALID_SHIFT))
return -EINVAL;

return 0;
}

static int altr_a10sr_gpio_direction_output(struct gpio_chip *gc,
unsigned int nr, int value)
{
if (nr <= (ALTR_A10SR_OUT_VALID_RANGE_HI - ALTR_A10SR_LED_VALID_SHIFT)) {
altr_a10sr_gpio_set(gc, nr, value);
return 0;
}
return -EINVAL;
if (nr > (ALTR_A10SR_OUT_VALID_RANGE_HI - ALTR_A10SR_LED_VALID_SHIFT))
return -EINVAL;

altr_a10sr_gpio_set(gc, nr, value);
return 0;
}

static const struct gpio_chip altr_a10sr_gc = {
Expand Down

0 comments on commit 68b7587

Please sign in to comment.