Skip to contentSkip to conversation

staging: qlge: avoid multiple assignments

PATCH In review Khadija Kamran 2 participants 2 messages Mar 22, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: qlge: avoid multiple assignments

Linux kernel coding style does not allow multiple assignments on a single line.
Avoid multiple assignments by assigning value to each variable in a separate line.

---
 drivers/staging/qlge/qlge_main.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/staging/qlge/qlge_main.c +8 -2
index 1ead7793062a..b35fb7db2a77 100644
@@ -4085,7 +4085,11 @@ static struct net_device_stats *qlge_get_stats(struct net_device
 	int i;
 
 	/* Get RX stats. */
-	pkts = mcast = dropped = errors = bytes = 0;
+	pkts = 0;
+	mcast = 0;
+	dropped = 0;
+	errors = 0;
+	bytes = 0;
 	for (i = 0; i < qdev->rss_ring_count; i++, rx_ring++) {
 		pkts += rx_ring->rx_packets;
 		bytes += rx_ring->rx_bytes;
@@ -4100,7 +4104,9 @@ static struct net_device_stats *qlge_get_stats(struct net_device
 	ndev->stats.multicast = mcast;
 
 	/* Get TX stats. */
-	pkts = errors = bytes = 0;
+	pkts = 0;
+	errors = 0;
+	bytes = 0;
 	for (i = 0; i < qdev->tx_ring_count; i++, tx_ring++) {
 		pkts += tx_ring->tx_packets;
 		bytes += tx_ring->tx_bytes;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 15 lines · Khadija Kamran

Linux kernel coding style does not allow multiple assignments on a single line.
Avoid multiple assignments by assigning value to each variable in a separate line.

---
 drivers/staging/qlge/qlge_main.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/staging/qlge/qlge_main.c +0 -0
index 1ead7793062a..b35fb7db2a77 100644

drivers/staging/qlge/qlge_main.c static struct net_device_stats *qlge_get_stats(struct net_device · line 4092

Quoted 9 lines
drivers/staging/qlge/qlge_main.c +5 -1
@@ -4085,7 +4085,11 @@ static struct net_device_stats *qlge_get_stats(struct net_device
 	int i;
 
 	/* Get RX stats. */
-	pkts = mcast = dropped = errors = bytes = 0;
+	pkts = 0;
+	mcast = 0;
+	dropped = 0;
+	errors = 0;
+	bytes = 0;

Nah, the original is fine, it makes it more obvious what is happening.

thanks,

greg k-h