* [PATCH][next][V2] mmc: wbsd: remove redundant assignment to variable id and id check
@ 2024-02-06 17:12 Colin Ian King
2024-02-13 16:45 ` Ulf Hansson
0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2024-02-06 17:12 UTC (permalink / raw)
To: Pierre Ossman, Ulf Hansson, Nathan Chancellor, linux-mmc; +Cc: kernel-janitors
The variable id is being initialized with a value that is never
read, it is being re-assigned later on. The initialization is
redundant and can be removed.
As noted by Ulf Hansson the unknown hardware check id != 0xFFFF
is also redundant and can be removed too.
Cleans up clang scan build warning:
drivers/mmc/host/wbsd.c:1287:4: warning: Value stored to 'id'
is never read [deadcode.DeadStores]
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
V2: As suggested by Ulf Hansson, also remove the redundant
hardware check for id != 0xFFFF.
---
drivers/mmc/host/wbsd.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c
index 001a468bc149..4b32421d9f6d 100644
--- a/drivers/mmc/host/wbsd.c
+++ b/drivers/mmc/host/wbsd.c
@@ -1284,8 +1284,6 @@ static int wbsd_scan(struct wbsd_host *host)
continue;
for (j = 0; j < ARRAY_SIZE(unlock_codes); j++) {
- id = 0xFFFF;
-
host->config = config_ports[i];
host->unlock_code = unlock_codes[j];
@@ -1306,11 +1304,6 @@ static int wbsd_scan(struct wbsd_host *host)
return 0;
}
}
-
- if (id != 0xFFFF) {
- DBG("Unknown hardware (id %x) found at %x\n",
- id, config_ports[i]);
- }
}
release_region(config_ports[i], 2);
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH][next][V2] mmc: wbsd: remove redundant assignment to variable id and id check
2024-02-06 17:12 [PATCH][next][V2] mmc: wbsd: remove redundant assignment to variable id and id check Colin Ian King
@ 2024-02-13 16:45 ` Ulf Hansson
0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2024-02-13 16:45 UTC (permalink / raw)
To: Colin Ian King
Cc: Pierre Ossman, Nathan Chancellor, linux-mmc, kernel-janitors
On Tue, 6 Feb 2024 at 18:12, Colin Ian King <colin.i.king@gmail.com> wrote:
>
> The variable id is being initialized with a value that is never
> read, it is being re-assigned later on. The initialization is
> redundant and can be removed.
>
> As noted by Ulf Hansson the unknown hardware check id != 0xFFFF
> is also redundant and can be removed too.
>
> Cleans up clang scan build warning:
> drivers/mmc/host/wbsd.c:1287:4: warning: Value stored to 'id'
> is never read [deadcode.DeadStores]
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
I had a second look and it's not entirely clear what the check if (id
!= 0xFFFF) is used for. Therefore, I suggest we simply keep that
check, to be safe.
That said, I decided to pick your patch v1 for next, thanks!
Kind regards
Uffe
> ---
> V2: As suggested by Ulf Hansson, also remove the redundant
> hardware check for id != 0xFFFF.
> ---
> drivers/mmc/host/wbsd.c | 7 -------
> 1 file changed, 7 deletions(-)
>
> diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c
> index 001a468bc149..4b32421d9f6d 100644
> --- a/drivers/mmc/host/wbsd.c
> +++ b/drivers/mmc/host/wbsd.c
> @@ -1284,8 +1284,6 @@ static int wbsd_scan(struct wbsd_host *host)
> continue;
>
> for (j = 0; j < ARRAY_SIZE(unlock_codes); j++) {
> - id = 0xFFFF;
> -
> host->config = config_ports[i];
> host->unlock_code = unlock_codes[j];
>
> @@ -1306,11 +1304,6 @@ static int wbsd_scan(struct wbsd_host *host)
> return 0;
> }
> }
> -
> - if (id != 0xFFFF) {
> - DBG("Unknown hardware (id %x) found at %x\n",
> - id, config_ports[i]);
> - }
> }
>
> release_region(config_ports[i], 2);
> --
> 2.39.2
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-13 16:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-06 17:12 [PATCH][next][V2] mmc: wbsd: remove redundant assignment to variable id and id check Colin Ian King
2024-02-13 16:45 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox