All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@kernel.org>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: Stanislaw Gruszka <stf_xl@wp.pl>,
	 lvc-project@linuxtesting.org, linux-wireless@vger.kernel.org
Subject: Re: [PATCH] wifi: rt2x00: remove useless code in rt2x00queue_create_tx_descriptor()
Date: Tue, 12 Dec 2023 20:04:11 +0200	[thread overview]
Message-ID: <87il53nvqc.fsf@kernel.org> (raw)
In-Reply-To: <20231212173421.119136-1-dmantipov@yandex.ru> (Dmitry Antipov's message of "Tue, 12 Dec 2023 20:34:18 +0300")

Dmitry Antipov <dmantipov@yandex.ru> writes:

> 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. This way,
> 'rate' becomes block-scoped later when determining the modulation.
> Compile tested only.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> ---
>  drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
> index 98df0aef8168..7f9955deb204 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
> @@ -389,7 +389,6 @@ static void rt2x00queue_create_tx_descriptor(struct rt2x00_dev *rt2x00dev,
>  	struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
>  	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
>  	struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0];
> -	struct ieee80211_rate *rate;

I think this should be kept.

> @@ -463,7 +459,8 @@ static void rt2x00queue_create_tx_descriptor(struct rt2x00_dev *rt2x00dev,
>  	else if (txrate->flags & IEEE80211_TX_RC_MCS)
>  		txdesc->rate_mode = RATE_MODE_HT_MIX;
>  	else {
> -		rate = ieee80211_get_tx_rate(rt2x00dev->hw, tx_info);
> +		struct ieee80211_rate *rate =
> +			ieee80211_get_tx_rate(rt2x00dev->hw, tx_info);

As I find it bad practice to declarare variables within if/else blocks.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

  reply	other threads:[~2023-12-12 18:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12 17:34 [PATCH] wifi: rt2x00: remove useless code in rt2x00queue_create_tx_descriptor() Dmitry Antipov
2023-12-12 18:04 ` Kalle Valo [this message]
2023-12-13  5:14   ` [PATCH] [v2] " Dmitry Antipov
2023-12-13 20:06     ` Stanislaw Gruszka
2023-12-15 13:40     ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87il53nvqc.fsf@kernel.org \
    --to=kvalo@kernel.org \
    --cc=dmantipov@yandex.ru \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=stf_xl@wp.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.