Skip to contentSkip to conversation

drivers: firmware: Handle error case in the zynqmp_pm_feature

PATCH Applied Venkatesh Yadav Abbarapu 2 participants 2 messages Oct 11, 2023 – Oct 19, 2023 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drivers: firmware: Handle error case in the zynqmp_pm_feature

Unhandled error coming from xilinx_pm_request() but return value is not read back that's why getting sparse warning as below:
warning: variable 'ret' set but not used [-Wunused-but-set-variable]. In case of error return the "ret" value.

---
Changes in v2:
- Fixed the commit description.
- Removed the newline.

---
 drivers/firmware/firmware-zynqmp.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/firmware/firmware-zynqmp.c +2 -0
index 43fb7fa778..8ea15c7ed3 100644
@@ -203,6 +203,8 @@ int zynqmp_pm_feature(const u32 api_id)
 	/* Check feature check API version */
 	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;
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 20 lines · Venkatesh Yadav Abbarapu

Unhandled error coming from xilinx_pm_request() but return value is not read back that's why getting sparse warning as below:
warning: variable 'ret' set but not used [-Wunused-but-set-variable]. In case of error return the "ret" value.

---
Changes in v2:
- Fixed the commit description.
- Removed the newline.

---
  drivers/firmware/firmware-zynqmp.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/firmware/firmware-zynqmp.c +0 -0
index 43fb7fa778..8ea15c7ed3 100644

drivers/firmware/firmware-zynqmp.c int zynqmp_pm_feature(const u32 api_id) · line 210

Quoted 8 lines
drivers/firmware/firmware-zynqmp.c +2 -0
@@ -203,6 +203,8 @@ int zynqmp_pm_feature(const u32 api_id)
  	/* Check feature check API version */
  	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;

Applied.
M