diff mbox series

[v2,06/17] staging: wfx: fix endianness of fields media_delay and tx_queue_delay

Message ID 20200512150414.267198-7-Jerome.Pouiller@silabs.com
State New
Headers show
Series [v2,01/17] staging: wfx: fix use of cpu_to_le32 instead of le32_to_cpu | expand

Commit Message

Jérôme Pouiller May 12, 2020, 3:04 p.m. UTC
From: Jérôme Pouiller <jerome.pouiller@silabs.com>

The struct hif_cnf_tx contains only little endian values. Thus, it is
necessary to fix byte ordering before to use them. Especially, sparse
detected wrong access to fields media_delay and tx_queue_delay.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/data_tx.c | 3 ++-
 drivers/staging/wfx/traces.h  | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c
index f64149ab0484..014fa36c8f78 100644
--- a/drivers/staging/wfx/data_tx.c
+++ b/drivers/staging/wfx/data_tx.c
@@ -562,7 +562,8 @@  void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg)
 
 	if (!arg->status) {
 		tx_info->status.tx_time =
-		arg->media_delay - arg->tx_queue_delay;
+			le32_to_cpu(arg->media_delay) -
+			le32_to_cpu(arg->tx_queue_delay);
 		if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK)
 			tx_info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
 		else
diff --git a/drivers/staging/wfx/traces.h b/drivers/staging/wfx/traces.h
index c78c46b1c990..959a0d31bf4e 100644
--- a/drivers/staging/wfx/traces.h
+++ b/drivers/staging/wfx/traces.h
@@ -387,8 +387,8 @@  TRACE_EVENT(tx_stats,
 		int i;
 
 		__entry->pkt_id = tx_cnf->packet_id;
-		__entry->delay_media = tx_cnf->media_delay;
-		__entry->delay_queue = tx_cnf->tx_queue_delay;
+		__entry->delay_media = le32_to_cpu(tx_cnf->media_delay);
+		__entry->delay_queue = le32_to_cpu(tx_cnf->tx_queue_delay);
 		__entry->delay_fw = delay;
 		__entry->ack_failures = tx_cnf->ack_failures;
 		if (!tx_cnf->status || __entry->ack_failures)