Re: [PATCH] tee: optee: smc: remove unnecessary NULL check before release_firmware()

From: Sumit Garg
Date: Thu Apr 24 2025 - 00:54:11 EST


On Thu, Apr 10, 2025 at 03:56:35PM +0800, Chen Ni wrote:
> release_firmware() checks for NULL pointers internally.
> Remove unneeded NULL check for fmw here.
>
> Signed-off-by: Chen Ni <nichen@xxxxxxxxxxx>
> ---
> drivers/tee/optee/smc_abi.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Sumit Garg <sumit.garg@xxxxxxxxxxxxxxxx>

-Sumit

>
> diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c
> index f0c3ac1103bb..26f8f7bbbe56 100644
> --- a/drivers/tee/optee/smc_abi.c
> +++ b/drivers/tee/optee/smc_abi.c
> @@ -1551,8 +1551,7 @@ static int optee_load_fw(struct platform_device *pdev,
> data_pa_high, data_pa_low, 0, 0, 0, &res);
> if (!rc)
> rc = res.a0;
> - if (fw)
> - release_firmware(fw);
> + release_firmware(fw);
> kfree(data_buf);
>
> if (!rc) {
> --
> 2.25.1
>