Thread (16 messages) flat view 16 messages, 2 authors, 2021-11-27
STALE1719d LANDED

Revision v2 of 2 in this series; landed in mainline as 3605f104111e on 2021-11-26.

Revisions (2)
  1. v1 [diff vs current]
  2. v2 current

[PATCH v2 05/11] pinctrl: apple: handle regmap_read errors

From: Joey Gouly <joey.gouly@arm.com>
Date: 2021-11-21 16:57:23
Subsystem: arm/apple machine support, pin control subsystem, the rest · Maintainers: Sven Peter, Janne Grunau, Linus Walleij, Linus Torvalds

Explicitly return 0 if the regmap_read fails.
Also change a uint32_t to a u32.

Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Suggested-by: Andy Shevchenko <redacted>
---
 drivers/pinctrl/pinctrl-apple-gpio.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-apple-gpio.c b/drivers/pinctrl/pinctrl-apple-gpio.c
index cce95367c156..bd7f28150ac0 100644
--- a/drivers/pinctrl/pinctrl-apple-gpio.c
+++ b/drivers/pinctrl/pinctrl-apple-gpio.c
@@ -81,12 +81,16 @@ static void apple_gpio_set_reg(struct apple_gpio_pinctrl *pctl,
 	regmap_update_bits(pctl->map, REG_GPIO(pin), mask, value);
 }
 
-static uint32_t apple_gpio_get_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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help