[PATCH v2 2/4] gpio: zynqmp: Handle error from get_gpio_modepin

Ashok Reddy Soma ashok.reddy.soma at amd.com
Fri Jan 20 06:36:15 CET 2023


From: Algapally Santosh Sagar <santoshsagar.algapally at amd.com>

There is a unused variable ret, due to which we are getting sparse warning
as below.
warning: variable 'ret' set but not used [-Wunused-but-set-variable].

Return ret incase of error.

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally at amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma at amd.com>
---

Changes in v2:
 - Instead of removing ret variable, take it and return incase of error.
 - Updated description as per this.

 drivers/gpio/zynqmp_gpio_modepin.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpio/zynqmp_gpio_modepin.c b/drivers/gpio/zynqmp_gpio_modepin.c
index 078fd83395..e9565ff543 100644
--- a/drivers/gpio/zynqmp_gpio_modepin.c
+++ b/drivers/gpio/zynqmp_gpio_modepin.c
@@ -48,6 +48,9 @@ static int modepin_gpio_set_value(struct udevice *dev, unsigned int offset,
 	int ret;
 
 	ret = get_gpio_modepin(ret_payload);
+	if (ret)
+		return ret;
+
 	if (value)
 		out_val = OUTVAL(offset) | ret_payload[1];
 	else
-- 
2.17.1



More information about the U-Boot mailing list