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

Michal Simek monstr at monstr.eu
Tue Oct 10 08:43:46 CEST 2023



On 10/10/23 08:31, Venkatesh Yadav Abbarapu wrote:
> There is a unused variable ret, due to which we are getting sparse warning

I wouldn't say unused because it is used but only for writing not for reading.

> as below.
> warning: variable 'ret' set but not used [-Wunused-but-set-variable].
> In case of error return the "ret" value.

I would revert description. Subject is correct.
It is unhandled error coming from xilinx_pm_request() but return value is not 
read back that's why also sparse warns about it as below:

> 
> 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);
>   

remove this newline.

> +	if (ret)
> +		return ret;
> +
>   	/* Return feature check version */
>   	return ret_payload[1] & FIRMWARE_VERSION_MASK;
>   }

M


-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP/Versal ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal/Versal NET SoCs
TF-A maintainer - Xilinx ZynqMP/Versal/Versal NET SoCs


More information about the U-Boot mailing list