usb: lvstest: Fix sparse warnings generated by kbuild test bot
authorPratyush Anand <pratyush.anand@st.com>
Mon, 21 Jul 2014 04:46:53 +0000 (10:16 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Jul 2014 23:30:58 +0000 (16:30 -0700)
Following sparse warnings were reported by kbuild test bot

drivers/usb/misc/lvstest.c:314:28: sparse: incorrect type in assignment (different base types)
   drivers/usb/misc/lvstest.c:314:28:    expected unsigned short [unsigned] [usertype] portchange
   drivers/usb/misc/lvstest.c:314:28:    got restricted __le16 [usertype] wPortChange
drivers/usb/misc/lvstest.c:332:40: sparse: restricted __le16 degrades to integer

This patch fixes above warnings.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/misc/lvstest.c

index 02df9a72b9900eee8e251448f063394f0b80e0ad..7d589c156fb1bc6bdb99d31c351deb4b08c0b9f8 100644 (file)
@@ -311,7 +311,7 @@ static void lvs_rh_work(struct work_struct *work)
                if (ret < 4)
                        continue;
 
-               portchange = port_status->wPortChange;
+               portchange = le16_to_cpu(port_status->wPortChange);
 
                if (portchange & USB_PORT_STAT_C_LINK_STATE)
                        lvs_rh_clear_port_feature(hdev, i,
@@ -329,7 +329,7 @@ static void lvs_rh_work(struct work_struct *work)
                        lvs_rh_clear_port_feature(hdev, i,
                                        USB_PORT_FEAT_C_CONNECTION);
 
-                       if (port_status->wPortStatus &
+                       if (le16_to_cpu(port_status->wPortStatus) &
                                        USB_PORT_STAT_CONNECTION) {
                                lvs->present = true;
                                lvs->portnum = i;