Introduce the use of function put_unaligned_le32.
A simplified version of Coccinelle semantic patch used -
@@ identifier tmp; expression ptr; expression y,e; type T; @@
- tmp = cpu_to_le32(y);
<+... when != tmp
- memcpy(ptr, (T)&tmp, ...);
+ put_unaligned_le32(y,ptr);
...+>
? tmp = e
@@ type T; identifier tmp; @@
- T tmp;
...when != tmp
Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
u8 buf[5];
memset(buf, 0, 5);
- mask = cpu_to_le32(mask);
- memcpy(buf, &mask, 4);
+ put_unaligned_le32(mask, buf);
buf[4] = arg;
FillH2CCmd(padapter, MACID_CONFIG_EID, 5, buf);