* Re: [PATCH] ath: Remove unneeded variable
[not found] ` <b41c50989125dec782e1fbd2793d0ecf@208suo.com>
@ 2023-06-13 9:47 ` Kalle Valo
2023-06-14 3:09 ` baomingtong001
1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2023-06-13 9:47 UTC (permalink / raw)
To: baomingtong001; +Cc: toke, linux-wireless, linux-kernel
baomingtong001@208suo.com writes:
> Fix the following coccicheck warning:
>
> drivers/net/wireless/ath/ath9k/gpio.c:501:5-8: Unneeded variable: "len".
>
> Signed-off-by: Mingtong Bao <baomingtong001@208suo.com>
No HTML emails, our lists drop those automatically. Please use 'git
send-email', more info in the wiki below.
This is not the first time I'm commenting about this for a patch from
208suo.com:
https://lore.kernel.org/linux-wireless/87zg57fne1.fsf@kernel.org/
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ath: Remove unneeded variable
[not found] ` <b41c50989125dec782e1fbd2793d0ecf@208suo.com>
2023-06-13 9:47 ` [PATCH] ath: Remove unneeded variable Kalle Valo
@ 2023-06-14 3:09 ` baomingtong001
2023-06-14 5:17 ` Kalle Valo
2023-06-14 12:07 ` Julian Calaby
1 sibling, 2 replies; 4+ messages in thread
From: baomingtong001 @ 2023-06-14 3:09 UTC (permalink / raw)
To: toke, kvalo; +Cc: linux-wireless, linux-kernel
Fix the following coccicheck warning:
drivers/net/wireless/ath/ath9k/gpio.c:501:5-8: Unneeded variable: "len".
Signed-off-by: Mingtong Bao <baomingtong001@208suo.com>
---
drivers/net/wireless/ath/ath9k/gpio.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/gpio.c
b/drivers/net/wireless/ath/ath9k/gpio.c
index b457e52dd365..f3d1bc02e633 100644
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
@@ -498,14 +498,13 @@ static int ath9k_dump_legacy_btcoex(struct
ath_softc *sc, u8 *buf, u32 size)
{
struct ath_btcoex *btcoex = &sc->btcoex;
- u32 len = 0;
ATH_DUMP_BTCOEX("Stomp Type", btcoex->bt_stomp_type);
ATH_DUMP_BTCOEX("BTCoex Period (msec)", btcoex->btcoex_period);
ATH_DUMP_BTCOEX("Duty Cycle", btcoex->duty_cycle);
ATH_DUMP_BTCOEX("BT Wait time", btcoex->bt_wait_time);
- return len;
+ return 0;
}
int ath9k_dump_btcoex(struct ath_softc *sc, u8 *buf, u32 size)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ath: Remove unneeded variable
2023-06-14 3:09 ` baomingtong001
@ 2023-06-14 5:17 ` Kalle Valo
2023-06-14 12:07 ` Julian Calaby
1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2023-06-14 5:17 UTC (permalink / raw)
To: baomingtong001; +Cc: toke, linux-wireless, linux-kernel
baomingtong001@208suo.com writes:
> Fix the following coccicheck warning:
>
> drivers/net/wireless/ath/ath9k/gpio.c:501:5-8: Unneeded variable: "len".
>
> Signed-off-by: Mingtong Bao <baomingtong001@208suo.com>
> ---
> drivers/net/wireless/ath/ath9k/gpio.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
The "wifi: ath9k:" prefix is missing from the title. And also try to
make titles unique so something like this:
"wifi: ath9k: remove unneeded variable from ath9k_dump_legacy_btcoex()"
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ath: Remove unneeded variable
2023-06-14 3:09 ` baomingtong001
2023-06-14 5:17 ` Kalle Valo
@ 2023-06-14 12:07 ` Julian Calaby
1 sibling, 0 replies; 4+ messages in thread
From: Julian Calaby @ 2023-06-14 12:07 UTC (permalink / raw)
To: baomingtong001; +Cc: toke, kvalo, linux-wireless, linux-kernel
Hi Mingtong,
On Wed, Jun 14, 2023 at 1:23 PM <baomingtong001@208suo.com> wrote:
>
> Fix the following coccicheck warning:
>
> drivers/net/wireless/ath/ath9k/gpio.c:501:5-8: Unneeded variable: "len".
Coccinelle / Coccicheck is unable to accurately detect unused
variables as it can only analyse the code as it is written and
doesn't, for example, expand macros. This produces false positives
like the one you're trying to fix in this patch.
> Signed-off-by: Mingtong Bao <baomingtong001@208suo.com>
> ---
> drivers/net/wireless/ath/ath9k/gpio.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/gpio.c
> b/drivers/net/wireless/ath/ath9k/gpio.c
> index b457e52dd365..f3d1bc02e633 100644
> --- a/drivers/net/wireless/ath/ath9k/gpio.c
> +++ b/drivers/net/wireless/ath/ath9k/gpio.c
> @@ -498,14 +498,13 @@ static int ath9k_dump_legacy_btcoex(struct
> ath_softc *sc, u8 *buf, u32 size)
> {
>
> struct ath_btcoex *btcoex = &sc->btcoex;
> - u32 len = 0;
>
> ATH_DUMP_BTCOEX("Stomp Type", btcoex->bt_stomp_type);
ATH_DUMP_BTCOEX() is a macro that relies on a bunch of local variables
being defined, one of which is "len". If you'd compiled this code, you
would have spotted this problem immediately.
A "correct" solution to the "problem" here might be to add the local
variables to the macro parameters or move the definition of the macro
closer to where it's used so it's more obvious that some "magic" is
going on here.
As others have said, you need to fully understand what code is doing
before producing these sorts of cleanups, otherwise you'll produce
incorrect patches like this one.
Thanks,
--
Julian Calaby
Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-06-14 12:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230613093757.5380-1-luojianhong@cdjrlc.com>
[not found] ` <b41c50989125dec782e1fbd2793d0ecf@208suo.com>
2023-06-13 9:47 ` [PATCH] ath: Remove unneeded variable Kalle Valo
2023-06-14 3:09 ` baomingtong001
2023-06-14 5:17 ` Kalle Valo
2023-06-14 12:07 ` Julian Calaby
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).