Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1609265 > unrolled thread

[PATCH] Convert __le16 to cpu before casting to u32

Started byGuillaume Brogi <gui-gui@netcourrier.com>
First post2017-03-26 00:40 +0100
Last post2017-03-26 00:40 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] Convert __le16 to cpu before casting to u32 Guillaume Brogi <gui-gui@netcourrier.com> - 2017-03-26 00:40 +0100

#1609265 — [PATCH] Convert __le16 to cpu before casting to u32

FromGuillaume Brogi <gui-gui@netcourrier.com>
Date2017-03-26 00:40 +0100
Subject[PATCH] Convert __le16 to cpu before casting to u32
Message-ID<tp3rQ-80V-7@gated-at.bofh.it>
This patch fixes the following sparse warnings:
drivers/staging/rtl8192u/r8192U_dm.c:2307:49: warning: cast from restricted __le16
drivers/staging/rtl8192u/r8192U_dm.c:2308:44: warning: cast from restricted __le16
drivers/staging/rtl8192u/r8192U_dm.c:2309:44: warning: cast from restricted __le16

Those three members of qos_parameters are indeed __le16 so they should
be converted to the cpu's endianness before being cast to u32.

The lines are over the 80 character limit. They already were, and, for
the sake of readability, I don't think they should be split.

Signed-off-by: Guillaume Brogi <gui-gui@netcourrier.com>
---
 drivers/staging/rtl8192u/r8192U_dm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
index 9209aad0515e..5946c1f8d37d 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -2304,9 +2304,9 @@ static void dm_check_edca_turbo(
 				/*  For Each time updating EDCA parameter, reset EDCA turbo mode status. */
 				dm_init_edca_turbo(dev);
 				u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime;
-				u4bAcParam = (((u32)(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)|
-					(((u32)(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET)|
-					(((u32)(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET)|
+				u4bAcParam = (((u32)le16_to_cpu(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET) |
+					(((u32)le16_to_cpu(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET) |
+					(((u32)le16_to_cpu(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET) |
 					((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET);
 				/*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/
 				write_nic_dword(dev, EDCAPARA_BE,  u4bAcParam);
-- 
2.12.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web