Skip to content

Commit

Permalink
pinctrl: nomadik: silence uninitialized variable warning
Browse files Browse the repository at this point in the history
This is harmless, but "val" isn't necessarily initialized if
abx500_get_register_interruptible() fails.  I've re-arranged the code to
just return an error code in that situation.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Dan Carpenter authored and Linus Walleij committed Aug 10, 2018
1 parent 504c769 commit c2944a9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/pinctrl/nomadik/pinctrl-abx500.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,16 @@ static int abx500_gpio_get_bit(struct gpio_chip *chip, u8 reg,
reg += offset / 8;
ret = abx500_get_register_interruptible(pct->dev,
AB8500_MISC, reg, &val);

*bit = !!(val & BIT(pos));

if (ret < 0)
if (ret < 0) {
dev_err(pct->dev,
"%s read reg =%x, offset=%x failed (%d)\n",
__func__, reg, offset, ret);
return ret;
}

return ret;
*bit = !!(val & BIT(pos));

return 0;
}

static int abx500_gpio_set_bits(struct gpio_chip *chip, u8 reg,
Expand Down

0 comments on commit c2944a9

Please sign in to comment.