Skip to contentSkip to conversation

drivers: staging: rtl8723au: get rid of unneeded memset/memcpy

PATCH NAK Emil Renner Berthing 3 participants 3 messages Dec 7, 2014 – Jan 18, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: staging: rtl8723au: get rid of unneeded memset/memcpy

This also fixes a sparse warning.

---
 drivers/staging/rtl8723au/hal/rtl8723a_cmd.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/staging/rtl8723au/hal/rtl8723a_cmd.c +7 -6
index 7b56411..d8c4c8b 100644
@@ -124,14 +124,15 @@ int rtl8723a_set_rssi_cmd(struct rtw_adapter *padapter, u8 *param)
 
 int rtl8723a_set_raid_cmd(struct rtw_adapter *padapter, u32 mask, u8 arg)
 {
-	u8 buf[5];
+	struct {
+		__le32 mask;
+		u8 arg;
+	} __packed buf;
 
-	memset(buf, 0, 5);
-	mask = cpu_to_le32(mask);
-	memcpy(buf, &mask, 4);
-	buf[4]  = arg;
+	buf.mask = cpu_to_le32(mask);
+	buf.arg = arg;
 
-	FillH2CCmd(padapter, MACID_CONFIG_EID, 5, buf);
+	FillH2CCmd(padapter, MACID_CONFIG_EID, 5, (u8 *)&buf);
 
 	return _SUCCESS;
 }
Signature · 1 line
2.1.3
#1 lore raw
Quoted 1 line · Emil Renner Berthing

This also fixes a sparse warning.

What sparse warning? What's wrong with the original code? Unless Jes resends this to me, I don't see the need to apply it, sorry.

greg k-h

#2 lore raw
Quoted 5 lines · Greg Kroah-Hartman
Quoted 1 line · Emil Renner Berthing

This also fixes a sparse warning.

What sparse warning? What's wrong with the original code? Unless Jes resends this to me, I don't see the need to apply it, sorry.

I agree, I cannot see what this is fixing, it does however add an ugly cast.

If you want to change the paramters passed to FillH2CCmd() then change the prototype and create something like struct h2c_cmd_arg{} and apply that across the board.

NACK

Jes