[PATCH] mmc: Fix static checker warnings

Michal Simek michal.simek at amd.com
Tue Oct 4 14:32:40 CEST 2022



On 9/29/22 06:52, Venkatesh Yadav Abbarapu wrote:
> Correct pointer dereferencing check to be more consistent.
> 
> Eliminate the below smatch warning:
> drivers/mmc/mmc.c:3118 mmc_init_device()
> warn: variable dereferenced before check 'm' (see line 3116)
> 
> Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu at amd.com>
> ---
> 
>   drivers/mmc/mmc.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 0b7c0be8cb..210703ea46 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -3113,10 +3113,12 @@ int mmc_init_device(int num)
>   	}
>   
>   	m = mmc_get_mmc_dev(dev);
> -	m->user_speed_mode = MMC_MODES_END; /* Initialising user set speed mode */
> -
>   	if (!m)
>   		return 0;
> +
> +	/* Initialising user set speed mode */
> +	m->user_speed_mode = MMC_MODES_END;
> +
>   	if (m->preinit)
>   		mmc_start_init(m);
>   

Reviewed-by: Michal Simek <michal.simek at amd.com>

Thanks,
Michal


More information about the U-Boot mailing list