diff mbox series

[v2] wifi: rt2x00: remove useless code in rt2x00queue_create_tx_descriptor()

Message ID 20231213051449.126963-1-dmantipov@yandex.ru (mailing list archive)
State Accepted
Commit 5a1745807580618e2524913f0c71bd779d94f0e5
Delegated to: Kalle Valo
Headers show
Series [v2] wifi: rt2x00: remove useless code in rt2x00queue_create_tx_descriptor() | expand

Commit Message

Dmitry Antipov Dec. 13, 2023, 5:14 a.m. UTC
In 'rt2x00queue_create_tx_descriptor()', there is no need to call
'ieee80211_get_rts_cts_rate()' while checking for RTS/CTS frame
since this function returns NULL or pointer to internal bitrate
table entry, and the return value is not actually used. Compile
tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
v2: avoid scoped locals (Kalle Valo)
---
 drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Stanislaw Gruszka Dec. 13, 2023, 8:06 p.m. UTC | #1
On Wed, Dec 13, 2023 at 08:14:43AM +0300, Dmitry Antipov wrote:
> In 'rt2x00queue_create_tx_descriptor()', there is no need to call
> 'ieee80211_get_rts_cts_rate()' while checking for RTS/CTS frame
> since this function returns NULL or pointer to internal bitrate
> table entry, and the return value is not actually used. Compile
> tested only.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> ---
> v2: avoid scoped locals (Kalle Valo)
> ---
>  drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
> index 98df0aef8168..013003777fee 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
> @@ -416,9 +416,6 @@ static void rt2x00queue_create_tx_descriptor(struct rt2x00_dev *rt2x00dev,
>  			__set_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags);
>  		else
>  			__set_bit(ENTRY_TXD_CTS_FRAME, &txdesc->flags);
> -		if (tx_info->control.rts_cts_rate_idx >= 0)
> -			rate =
> -			    ieee80211_get_rts_cts_rate(rt2x00dev->hw, tx_info);
>  	}
So we do not choose rate for RTS/CTS. Maybe we should actually,
but the patch does not change the logic that exist here for 
more than 12 years, since

commit 55b585e29095ce64900b6192aadf399fa007161e
Author: Helmut Schaa <helmut.schaa@googlemail.com>
Date:   Thu Mar 3 19:43:49 2011 +0100

    rt2x00: Don't call ieee80211_get_tx_rate for MCS rates

I'm ok with the patch.

Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>

Thanks
Stanislaw
Kalle Valo Dec. 15, 2023, 1:40 p.m. UTC | #2
Dmitry Antipov <dmantipov@yandex.ru> wrote:

> In 'rt2x00queue_create_tx_descriptor()', there is no need to call
> 'ieee80211_get_rts_cts_rate()' while checking for RTS/CTS frame
> since this function returns NULL or pointer to internal bitrate
> table entry, and the return value is not actually used. Compile
> tested only.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>

Patch applied to wireless-next.git, thanks.

5a1745807580 wifi: rt2x00: remove useless code in rt2x00queue_create_tx_descriptor()
diff mbox series

Patch

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
index 98df0aef8168..013003777fee 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
@@ -416,9 +416,6 @@  static void rt2x00queue_create_tx_descriptor(struct rt2x00_dev *rt2x00dev,
 			__set_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags);
 		else
 			__set_bit(ENTRY_TXD_CTS_FRAME, &txdesc->flags);
-		if (tx_info->control.rts_cts_rate_idx >= 0)
-			rate =
-			    ieee80211_get_rts_cts_rate(rt2x00dev->hw, tx_info);
 	}
 
 	/*