usb: wusbcore: Use put_unaligned_le32
authorHimanshu Jha <himanshujha199640@gmail.com>
Tue, 17 Oct 2017 11:44:30 +0000 (17:14 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Nov 2017 15:51:09 +0000 (16:51 +0100)
commitb6565a07ca67f9b94fdc21ea1bc958236fcd7a71
tree2f617b0330721e1072f3a83d4c92b3303b1110b1
parent06211656233f76643e5b82c343b726457689bec1
usb: wusbcore: Use put_unaligned_le32

Use put_unaligned_le32 rather than using byte ordering function and
memcpy which makes code clear.
Also, add the header file where it is declared.

Done using Coccinelle and semantic patch used is :

@ rule1 @
identifier tmp; expression ptr,x; type T;
@@

- tmp = cpu_to_le32(x);

  <+... when != tmp
- memcpy(ptr, (T)&tmp, ...);
+ put_unaligned_le32(x,ptr);
  ...+>

@ depends on rule1 @
type j; identifier tmp;
@@

- j tmp;
  ...when != tmp

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/wusbcore/security.c