public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] mmc: Fix static checker warnings
@ 2022-09-29  4:52 ` Venkatesh Yadav Abbarapu
  2022-10-04 12:32   ` Michal Simek
                     ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Venkatesh Yadav Abbarapu @ 2022-09-29  4:52 UTC (permalink / raw)
  To: u-boot; +Cc: peng.fan, jh80.chung, git

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: Fix static checker warnings
  2022-09-29  4:52 ` [PATCH] mmc: Fix static checker warnings Venkatesh Yadav Abbarapu
@ 2022-10-04 12:32   ` Michal Simek
  2022-10-07 12:39   ` Jaehoon Chung
  2022-10-25  0:02   ` Jaehoon Chung
  2 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2022-10-04 12:32 UTC (permalink / raw)
  To: Venkatesh Yadav Abbarapu, u-boot; +Cc: peng.fan, jh80.chung, git



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@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@amd.com>

Thanks,
Michal

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: Fix static checker warnings
  2022-09-29  4:52 ` [PATCH] mmc: Fix static checker warnings Venkatesh Yadav Abbarapu
  2022-10-04 12:32   ` Michal Simek
@ 2022-10-07 12:39   ` Jaehoon Chung
  2022-10-25  0:02   ` Jaehoon Chung
  2 siblings, 0 replies; 4+ messages in thread
From: Jaehoon Chung @ 2022-10-07 12:39 UTC (permalink / raw)
  To: Venkatesh Yadav Abbarapu, u-boot; +Cc: peng.fan, jh80.chung, git



On 9/29/22 13: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@amd.com>


Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: Fix static checker warnings
  2022-09-29  4:52 ` [PATCH] mmc: Fix static checker warnings Venkatesh Yadav Abbarapu
  2022-10-04 12:32   ` Michal Simek
  2022-10-07 12:39   ` Jaehoon Chung
@ 2022-10-25  0:02   ` Jaehoon Chung
  2 siblings, 0 replies; 4+ messages in thread
From: Jaehoon Chung @ 2022-10-25  0:02 UTC (permalink / raw)
  To: Venkatesh Yadav Abbarapu, u-boot; +Cc: peng.fan, git

On 9/29/22 13: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@amd.com>
> Reviewed-by: Michal Simek <michal.simek@amd.com>
> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Applied to u-boot-mmc. Thanks!

Best Regards,
Jaehoon Chung


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-25  0:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20221025000241epcas1p3a68b2f9154afa86b6f35f6f729d4b644@epcas1p3.samsung.com>
2022-09-29  4:52 ` [PATCH] mmc: Fix static checker warnings Venkatesh Yadav Abbarapu
2022-10-04 12:32   ` Michal Simek
2022-10-07 12:39   ` Jaehoon Chung
2022-10-25  0:02   ` Jaehoon Chung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox