* [PATCH] staging: qlge: avoid multiple assignments
@ 2023-03-22 19:21 Khadija Kamran
2023-03-22 19:30 ` Greg Kroah-Hartman
0 siblings, 1 reply; 2+ messages in thread
From: Khadija Kamran @ 2023-03-22 19:21 UTC (permalink / raw)
To: outreachy
Cc: Manish Chopra, GR-Linux-NIC-Dev, Coiby Xu, Greg Kroah-Hartman,
netdev, linux-staging, linux-kernel
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.
Signed-off-by: Khadija Kamran <kamrankhadijadj@gmail.com>
---
drivers/staging/qlge/qlge_main.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
index 1ead7793062a..b35fb7db2a77 100644
--- a/drivers/staging/qlge/qlge_main.c
+++ b/drivers/staging/qlge/qlge_main.c
@@ -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;
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] staging: qlge: avoid multiple assignments
2023-03-22 19:21 [PATCH] staging: qlge: avoid multiple assignments Khadija Kamran
@ 2023-03-22 19:30 ` Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2023-03-22 19:30 UTC (permalink / raw)
To: Khadija Kamran
Cc: outreachy, Manish Chopra, GR-Linux-NIC-Dev, Coiby Xu, netdev,
linux-staging, linux-kernel
On Thu, Mar 23, 2023 at 12:21:22AM +0500, Khadija Kamran wrote:
> 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.
>
> Signed-off-by: Khadija Kamran <kamrankhadijadj@gmail.com>
> ---
> drivers/staging/qlge/qlge_main.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
> index 1ead7793062a..b35fb7db2a77 100644
> --- a/drivers/staging/qlge/qlge_main.c
> +++ b/drivers/staging/qlge/qlge_main.c
> @@ -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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-22 19:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-22 19:21 [PATCH] staging: qlge: avoid multiple assignments Khadija Kamran
2023-03-22 19:30 ` Greg Kroah-Hartman
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).