Linux MultiMedia Card development
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-esdhc-imx: Fix smatch errors
@ 2023-12-29 13:02 Hardevsinh Palaniya
  2023-12-29 14:34 ` Stefan Wahren
  0 siblings, 1 reply; 3+ messages in thread
From: Hardevsinh Palaniya @ 2023-12-29 13:02 UTC (permalink / raw)
  To: haibo.chen, ulf.hansson, shawnguo, s.hauer
  Cc: hardevsinh.palaniya, Adrian Hunter, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team, linux-mmc, linux-arm-kernel,
	linux-kernel

Resolve smatch errors in esdhc_executing_tuning()

esdhc_executing_tuning() error: uninitialized symbol 'target_min'
esdhc_executing_tuning() error: uninitialized symbol 'target_max'

Signed-off-by: Hardevsinh Palaniya <hardevsinh.palaniya@siliconsignals.io>

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 40a6e2f8145a..839b60138f04 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1166,6 +1166,8 @@ static int esdhc_executing_tuning(struct sdhci_host *host, u32 opcode)
 	min = ESDHC_TUNE_CTRL_MIN;
 	max = ESDHC_TUNE_CTRL_MIN;
 	target_win_length = 0;
+	target_min = 0;
+	target_max = 0;
 	while (max < ESDHC_TUNE_CTRL_MAX) {
 		/* find the mininum delay first which can pass tuning */
 		while (min < ESDHC_TUNE_CTRL_MAX) {
-- 
2.25.1


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

* Re: [PATCH] mmc: sdhci-esdhc-imx: Fix smatch errors
  2023-12-29 13:02 [PATCH] mmc: sdhci-esdhc-imx: Fix smatch errors Hardevsinh Palaniya
@ 2023-12-29 14:34 ` Stefan Wahren
  2024-01-04  7:12   ` Adrian Hunter
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Wahren @ 2023-12-29 14:34 UTC (permalink / raw)
  To: Hardevsinh Palaniya, haibo.chen, ulf.hansson, shawnguo, s.hauer
  Cc: Adrian Hunter, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, linux-mmc, linux-arm-kernel, linux-kernel

Hi Hardevsinh,

the patch subject is a too generic. Maybe something like "fix
initialization of target_min/max"

Am 29.12.23 um 14:02 schrieb Hardevsinh Palaniya:
> Resolve smatch errors in esdhc_executing_tuning()
>
> esdhc_executing_tuning() error: uninitialized symbol 'target_min'
> esdhc_executing_tuning() error: uninitialized symbol 'target_max'
I think this deserve

Fixes: 541a95e64d76 ("mmc: sdhci-esdhc-imx: optimize the manual tuing
logic to get the best timing")

Thanks
> Signed-off-by: Hardevsinh Palaniya <hardevsinh.palaniya@siliconsignals.io>
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 40a6e2f8145a..839b60138f04 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1166,6 +1166,8 @@ static int esdhc_executing_tuning(struct sdhci_host *host, u32 opcode)
>   	min = ESDHC_TUNE_CTRL_MIN;
>   	max = ESDHC_TUNE_CTRL_MIN;
>   	target_win_length = 0;
> +	target_min = 0;
> +	target_max = 0;
>   	while (max < ESDHC_TUNE_CTRL_MAX) {
>   		/* find the mininum delay first which can pass tuning */
>   		while (min < ESDHC_TUNE_CTRL_MAX) {


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

* Re: [PATCH] mmc: sdhci-esdhc-imx: Fix smatch errors
  2023-12-29 14:34 ` Stefan Wahren
@ 2024-01-04  7:12   ` Adrian Hunter
  0 siblings, 0 replies; 3+ messages in thread
From: Adrian Hunter @ 2024-01-04  7:12 UTC (permalink / raw)
  To: Stefan Wahren, Hardevsinh Palaniya, haibo.chen, ulf.hansson,
	shawnguo, s.hauer
  Cc: Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, linux-mmc,
	linux-arm-kernel, linux-kernel

On 29/12/23 16:34, Stefan Wahren wrote:
> Hi Hardevsinh,
> 
> the patch subject is a too generic. Maybe something like "fix
> initialization of target_min/max"
> 
> Am 29.12.23 um 14:02 schrieb Hardevsinh Palaniya:
>> Resolve smatch errors in esdhc_executing_tuning()
>>
>> esdhc_executing_tuning() error: uninitialized symbol 'target_min'
>> esdhc_executing_tuning() error: uninitialized symbol 'target_max'
> I think this deserve
> 
> Fixes: 541a95e64d76 ("mmc: sdhci-esdhc-imx: optimize the manual tuing
> logic to get the best timing")

Is smatch right though?

	while (max < ESDHC_TUNE_CTRL_MAX) {	// always true first iteration

	max = min + ESDHC_TUNE_CTRL_STEP;	// max > min

		max -= ESDHC_TUNE_CTRL_STEP;
		break;				// max >= min

	win_length = max - min + 1;		// always > 0 since max >= min

	if (win_length > target_win_length) {	// always true first iteration
		target_min = min;		// always initialized
		target_max = max;		// always initialized

> 
> Thanks
>> Signed-off-by: Hardevsinh Palaniya <hardevsinh.palaniya@siliconsignals.io>
>>
>> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
>> index 40a6e2f8145a..839b60138f04 100644
>> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
>> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
>> @@ -1166,6 +1166,8 @@ static int esdhc_executing_tuning(struct sdhci_host *host, u32 opcode)
>>       min = ESDHC_TUNE_CTRL_MIN;
>>       max = ESDHC_TUNE_CTRL_MIN;
>>       target_win_length = 0;
>> +    target_min = 0;
>> +    target_max = 0;
>>       while (max < ESDHC_TUNE_CTRL_MAX) {
>>           /* find the mininum delay first which can pass tuning */
>>           while (min < ESDHC_TUNE_CTRL_MAX) {
> 


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

end of thread, other threads:[~2024-01-04  7:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-29 13:02 [PATCH] mmc: sdhci-esdhc-imx: Fix smatch errors Hardevsinh Palaniya
2023-12-29 14:34 ` Stefan Wahren
2024-01-04  7:12   ` Adrian Hunter

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