[PATCH] drivers: firmware: Handle error case in the zynqmp_pm_feature

Venkatesh Yadav Abbarapu venkatesh.abbarapu at amd.com
Tue Oct 10 08:31:38 CEST 2023


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].
In case of error return the "ret" value.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu at amd.com>
---
 drivers/firmware/firmware-zynqmp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c
index 43fb7fa778..57d5a1f469 100644
--- a/drivers/firmware/firmware-zynqmp.c
+++ b/drivers/firmware/firmware-zynqmp.c
@@ -204,6 +204,9 @@ int zynqmp_pm_feature(const u32 api_id)
 	ret = xilinx_pm_request(PM_FEATURE_CHECK, api_id, 0, 0, 0,
 				ret_payload);
 
+	if (ret)
+		return ret;
+
 	/* Return feature check version */
 	return ret_payload[1] & FIRMWARE_VERSION_MASK;
 }
-- 
2.17.1



More information about the U-Boot mailing list