[PATCH] usb: lvstest: Fix sparse warnings generated by kbuild test bot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Pratyush Anand <pratyush.anand@xxxxxx>
---
 drivers/usb/misc/lvstest.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/misc/lvstest.c b/drivers/usb/misc/lvstest.c
index 02df9a7..dd53958 100644
--- a/drivers/usb/misc/lvstest.c
+++ b/drivers/usb/misc/lvstest.c
@@ -301,7 +301,7 @@ static void lvs_rh_work(struct work_struct *work)
 	struct usb_hub_descriptor *descriptor = &lvs->descriptor;
 	struct usb_port_status *port_status = &lvs->port_status;
 	int i, ret = 0;
-	u16 portchange;
+	__le16 portchange;
 
 	/* Examine each root port */
 	for (i = 1; i <= descriptor->bNbrPorts; i++) {
@@ -313,23 +313,23 @@ static void lvs_rh_work(struct work_struct *work)
 
 		portchange = port_status->wPortChange;
 
-		if (portchange & USB_PORT_STAT_C_LINK_STATE)
+		if (le16_to_cpu(portchange) & USB_PORT_STAT_C_LINK_STATE)
 			lvs_rh_clear_port_feature(hdev, i,
 					USB_PORT_FEAT_C_PORT_LINK_STATE);
-		if (portchange & USB_PORT_STAT_C_ENABLE)
+		if (le16_to_cpu(portchange) & USB_PORT_STAT_C_ENABLE)
 			lvs_rh_clear_port_feature(hdev, i,
 					USB_PORT_FEAT_C_ENABLE);
-		if (portchange & USB_PORT_STAT_C_RESET)
+		if (le16_to_cpu(portchange) & USB_PORT_STAT_C_RESET)
 			lvs_rh_clear_port_feature(hdev, i,
 					USB_PORT_FEAT_C_RESET);
-		if (portchange & USB_PORT_STAT_C_BH_RESET)
+		if (le16_to_cpu(portchange) & USB_PORT_STAT_C_BH_RESET)
 			lvs_rh_clear_port_feature(hdev, i,
 					USB_PORT_FEAT_C_BH_PORT_RESET);
-		if (portchange & USB_PORT_STAT_C_CONNECTION) {
+		if (le16_to_cpu(portchange) & USB_PORT_STAT_C_CONNECTION) {
 			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;
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux