[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1644395972-4303-1-git-send-email-wangqing@vivo.com>
Date: Wed, 9 Feb 2022 00:39:32 -0800
From: Qing Wang <wangqing@...o.com>
To: Maya Erez <merez@...eaurora.org>,
Kalle Valo <kvalo@...eaurora.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
linux-wireless@...r.kernel.org, wil6210@....qualcomm.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Wang Qing <wangqing@...o.com>
Subject: [PATCH] net: wireless: ath: use div64_u64() instead of do_div()
From: Wang Qing <wangqing@...o.com>
do_div() does a 64-by-32 division.
When the divisor is u64, do_div() truncates it to 32 bits, this means it
can test non-zero and be truncated to zero for division.
fix do_div.cocci warning:
do_div() does a 64-by-32 division, please consider using div64_u64 instead.
Signed-off-by: Wang Qing <wangqing@...o.com>
---
drivers/net/wireless/ath/wil6210/debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
index 4c944e5..2cee9dd
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -1766,7 +1766,7 @@ __acquires(&p->tid_rx_lock) __releases(&p->tid_rx_lock)
seq_puts(s, "\n");
if (!num_packets)
continue;
- do_div(tx_latency_avg, num_packets);
+ div64_u64(tx_latency_avg, num_packets);
seq_printf(s, "Tx/Latency min/avg/max (us): %d/%lld/%d",
p->stats.tx_latency_min_us,
tx_latency_avg,
--
2.7.4
Powered by blists - more mailing lists