diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2018-08-08 15:04:49 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2018-08-11 00:14:04 +0300 |
commit | c2944a9a09a21b917fa86858f078e77115ca9d22 (patch) | |
tree | 08e466514ba20f6d4c24228b83f3ffdf5f7b5c50 /drivers/pinctrl/nomadik/pinctrl-abx500.c | |
parent | 504c76979bccec66e4c2e41f6a006e49e284466f (diff) | |
download | linux-c2944a9a09a21b917fa86858f078e77115ca9d22.tar.xz |
pinctrl: nomadik: silence uninitialized variable warning
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>
Diffstat (limited to 'drivers/pinctrl/nomadik/pinctrl-abx500.c')
-rw-r--r-- | drivers/pinctrl/nomadik/pinctrl-abx500.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/pinctrl/nomadik/pinctrl-abx500.c b/drivers/pinctrl/nomadik/pinctrl-abx500.c index aa592ef23a29..e3689cc62a41 100644 --- a/drivers/pinctrl/nomadik/pinctrl-abx500.c +++ b/drivers/pinctrl/nomadik/pinctrl-abx500.c @@ -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, |