diff options
author | Boris Sorochkin <boriss@codeaurora.org> | 2015-02-15 14:02:35 +0200 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-02-27 10:15:20 +0200 |
commit | 8f55cbec7f8856438eef80e23f26331bea124128 (patch) | |
tree | 9d3bdefd6a77da6ab45c747046ebfabc564cbd4c | |
parent | 0436fd9a2d1e0c87a621841ab48e779cf8f237b4 (diff) | |
download | linux-stable-8f55cbec7f8856438eef80e23f26331bea124128.tar.gz linux-stable-8f55cbec7f8856438eef80e23f26331bea124128.tar.bz2 linux-stable-8f55cbec7f8856438eef80e23f26331bea124128.zip |
wil6210: Fix division by zero in wil_vring_debugfs_show
On some platforms get_cycles() implemented to allways return 0.
On such platforms "Division by zero" bug was triggered.
Signed-off-by: Boris Sorochkin <boriss@codeaurora.org>
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r-- | drivers/net/wireless/ath/wil6210/debugfs.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index eb6de8cbdd7a..fd5975153386 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -103,23 +103,30 @@ static int wil_vring_debugfs_show(struct seq_file *s, void *data) % vring->size; int avail = vring->size - used - 1; char name[10]; + char sidle[10]; /* performance monitoring */ cycles_t now = get_cycles(); uint64_t idle = txdata->idle * 100; uint64_t total = now - txdata->begin; - do_div(idle, total); + if (total != 0) { + do_div(idle, total); + snprintf(sidle, sizeof(sidle), "%3d%%", + (int)idle); + } else { + snprintf(sidle, sizeof(sidle), "N/A"); + } txdata->begin = now; txdata->idle = 0ULL; snprintf(name, sizeof(name), "tx_%2d", i); seq_printf(s, - "\n%pM CID %d TID %d BACK([%d] %d TU A%s) [%3d|%3d] idle %3d%%\n", - wil->sta[cid].addr, cid, tid, - txdata->agg_wsize, txdata->agg_timeout, - txdata->agg_amsdu ? "+" : "-", - used, avail, (int)idle); + "\n%pM CID %d TID %d BACK([%d] %d TU A%s) [%3d|%3d] idle %s\n", + wil->sta[cid].addr, cid, tid, + txdata->agg_wsize, txdata->agg_timeout, + txdata->agg_amsdu ? "+" : "-", + used, avail, sidle); wil_print_vring(s, wil, name, vring, '_', 'H'); } |