Explicitly return 0 if the regmap_read fails. Signed-off-by: Joey Gouly <joey.gouly@xxxxxxx> --- drivers/pinctrl/pinctrl-apple-gpio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/pinctrl-apple-gpio.c b/drivers/pinctrl/pinctrl-apple-gpio.c index 4f7fb79d8e11..bd7f28150ac0 100644 --- a/drivers/pinctrl/pinctrl-apple-gpio.c +++ b/drivers/pinctrl/pinctrl-apple-gpio.c @@ -84,9 +84,13 @@ static void apple_gpio_set_reg(struct apple_gpio_pinctrl *pctl, static u32 apple_gpio_get_reg(struct apple_gpio_pinctrl *pctl, unsigned int pin) { - unsigned int val = 0; + int ret; + u32 val; + + ret = regmap_read(pctl->map, REG_GPIO(pin), &val); + if (ret) + return 0; - regmap_read(pctl->map, REG_GPIO(pin), &val); return val; } -- 2.17.1