All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: YueHaibing <yuehaibing@huawei.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Himadri Pandya <himadri18.07@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Colin Ian King <colin.king@canonical.com>,
	devel@driverdev.osuosl.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] staging: rtl8192e: Remove set but not used variables 'broad_addr, stype'
Date: Mon, 18 Feb 2019 14:31:14 +0000	[thread overview]
Message-ID: <20190218143114.GD17104@kadam> (raw)
In-Reply-To: <20190218123359.83746-1-yuehaibing@huawei.com>

On Mon, Feb 18, 2019 at 12:33:59PM +0000, YueHaibing wrote:
> @@ -1747,11 +1747,10 @@ static short _rtl92e_tx(struct net_device *dev, struct sk_buff *skb)
>  	header = (struct rtllib_hdr_1addr *)(((u8 *)skb->data) + fwinfo_size);
>  	fc = le16_to_cpu(header->frame_ctl);
>  	type = WLAN_FC_GET_TYPE(fc);
> -	stype = WLAN_FC_GET_STYPE(fc);
>  	pda_addr = header->addr1;
>  
>  	if (is_broadcast_ether_addr(pda_addr))
> -		broad_addr = true;
> +		;
>  	else if (is_multicast_ether_addr(pda_addr))
>  		multi_addr = true;
>  	else
> 

This is ugly.  Please do it like this:


diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index c145b689175c..29b53e2246b4 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -1729,7 +1729,6 @@ static short _rtl92e_tx(struct net_device *dev, struct sk_buff *skb)
 	struct tx_desc *pdesc = NULL;
 	struct rtllib_hdr_1addr *header = NULL;
 	u16 fc = 0, type = 0, stype = 0;
-	bool  multi_addr = false, broad_addr = false, uni_addr = false;
 	u8 *pda_addr = NULL;
 	int   idx;
 	u32 fwinfo_size = 0;
@@ -1751,18 +1750,11 @@ static short _rtl92e_tx(struct net_device *dev, struct sk_buff *skb)
 	pda_addr = header->addr1;
 
 	if (is_broadcast_ether_addr(pda_addr))
-		broad_addr = true;
+		priv->stats.txbytesbroadcast += skb->len - fwinfo_size;
 	else if (is_multicast_ether_addr(pda_addr))
-		multi_addr = true;
-	else
-		uni_addr = true;
-
-	if (uni_addr)
-		priv->stats.txbytesunicast += skb->len - fwinfo_size;
-	else if (multi_addr)
 		priv->stats.txbytesmulticast += skb->len - fwinfo_size;
 	else
-		priv->stats.txbytesbroadcast += skb->len - fwinfo_size;
+		priv->stats.txbytesunicast += skb->len - fwinfo_size;
 
 	spin_lock_irqsave(&priv->irq_th_lock, flags);
 	ring = &priv->tx_ring[tcb_desc->queue_index];

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: YueHaibing <yuehaibing@huawei.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Himadri Pandya <himadri18.07@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Colin Ian King <colin.king@canonical.com>,
	devel@driverdev.osuosl.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] staging: rtl8192e: Remove set but not used variables 'broad_addr, stype'
Date: Mon, 18 Feb 2019 17:31:14 +0300	[thread overview]
Message-ID: <20190218143114.GD17104@kadam> (raw)
In-Reply-To: <20190218123359.83746-1-yuehaibing@huawei.com>

On Mon, Feb 18, 2019 at 12:33:59PM +0000, YueHaibing wrote:
> @@ -1747,11 +1747,10 @@ static short _rtl92e_tx(struct net_device *dev, struct sk_buff *skb)
>  	header = (struct rtllib_hdr_1addr *)(((u8 *)skb->data) + fwinfo_size);
>  	fc = le16_to_cpu(header->frame_ctl);
>  	type = WLAN_FC_GET_TYPE(fc);
> -	stype = WLAN_FC_GET_STYPE(fc);
>  	pda_addr = header->addr1;
>  
>  	if (is_broadcast_ether_addr(pda_addr))
> -		broad_addr = true;
> +		;
>  	else if (is_multicast_ether_addr(pda_addr))
>  		multi_addr = true;
>  	else
> 

This is ugly.  Please do it like this:


diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index c145b689175c..29b53e2246b4 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -1729,7 +1729,6 @@ static short _rtl92e_tx(struct net_device *dev, struct sk_buff *skb)
 	struct tx_desc *pdesc = NULL;
 	struct rtllib_hdr_1addr *header = NULL;
 	u16 fc = 0, type = 0, stype = 0;
-	bool  multi_addr = false, broad_addr = false, uni_addr = false;
 	u8 *pda_addr = NULL;
 	int   idx;
 	u32 fwinfo_size = 0;
@@ -1751,18 +1750,11 @@ static short _rtl92e_tx(struct net_device *dev, struct sk_buff *skb)
 	pda_addr = header->addr1;
 
 	if (is_broadcast_ether_addr(pda_addr))
-		broad_addr = true;
+		priv->stats.txbytesbroadcast += skb->len - fwinfo_size;
 	else if (is_multicast_ether_addr(pda_addr))
-		multi_addr = true;
-	else
-		uni_addr = true;
-
-	if (uni_addr)
-		priv->stats.txbytesunicast += skb->len - fwinfo_size;
-	else if (multi_addr)
 		priv->stats.txbytesmulticast += skb->len - fwinfo_size;
 	else
-		priv->stats.txbytesbroadcast += skb->len - fwinfo_size;
+		priv->stats.txbytesunicast += skb->len - fwinfo_size;
 
 	spin_lock_irqsave(&priv->irq_th_lock, flags);
 	ring = &priv->tx_ring[tcb_desc->queue_index];

  reply	other threads:[~2019-02-18 14:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-18 12:33 [PATCH -next] staging: rtl8192e: Remove set but not used variables 'broad_addr, stype' YueHaibing
2019-02-18 12:33 ` YueHaibing
2019-02-18 14:31 ` Dan Carpenter [this message]
2019-02-18 14:31   ` Dan Carpenter
2019-02-18 14:48   ` YueHaibing
2019-02-18 14:48     ` YueHaibing
2019-02-18 15:15 ` [PATCH v2 " YueHaibing
2019-02-18 15:15   ` YueHaibing
2019-02-18 15:05   ` Dan Carpenter
2019-02-18 15:05     ` Dan Carpenter
2019-04-06  3:11 ` [PATCH -next] staging: rtl8192e: Remove set but not used variable 'VenderID' YueHaibing
2019-04-06  3:11   ` YueHaibing
2019-04-06  8:22   ` Mukesh Ojha
2019-04-06  8:34     ` Mukesh Ojha

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=20190218143114.GD17104@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=colin.king@canonical.com \
    --cc=davem@davemloft.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=himadri18.07@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuehaibing@huawei.com \
    /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.