Skip to contentSkip to conversation

net: sierra: shut up sparse restricted type warnings

PATCH Superseded Bjørn Mork 4 participants 7 messages Oct 26, 2012 – Oct 28, 2012 2 messages not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: sierra: shut up sparse restricted type warnings

Removes the warnings

drivers/net/usb/sierra_net.c:343:45: warning: incorrect type in assignment (different base types)
drivers/net/usb/sierra_net.c:343:45: expected unsigned short [unsigned] [short] [usertype] <noident>
drivers/net/usb/sierra_net.c:343:45: got restricted __be16 [usertype] <noident>

and

drivers/net/usb/sierra_net.c:658:18: warning: cast to restricted __le16

---
 drivers/net/usb/sierra_net.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/usb/sierra_net.c +2 -2
index c27d277..2c3b82e 100644
@@ -340,7 +340,7 @@ static void sierra_net_set_ctx_index(struct sierra_net_data *priv, u8 ctx_ix)
 	dev_dbg(&(priv->usbnet->udev->dev), "%s %d", __func__, ctx_ix);
 	priv->tx_hdr_template[0] = 0x3F;
 	priv->tx_hdr_template[1] = ctx_ix;
-	*((u16 *)&priv->tx_hdr_template[2]) =
+	*((__be16 *)&priv->tx_hdr_template[2]) =
 		cpu_to_be16(SIERRA_NET_HIP_EXT_IP_OUT_ID);
 }
 
@@ -632,7 +632,7 @@ static int sierra_net_change_mtu(struct net_device *net, int new_mtu)
 static int sierra_net_get_fw_attr(struct usbnet *dev, u16 *datap)
 {
 	int result = 0;
-	u16 *attrdata;
+	__le16 *attrdata;
 
 	attrdata = kmalloc(sizeof(*attrdata), GFP_KERNEL);
 	if (!attrdata)
Signature · 6 lines
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

PATCH 1/1 net: cdc_ncm: big endian fix

In reply to a message not in the archive

Probably doesn't matter much since the value is used as a boolean anyway, but it removes the sparse warning:

drivers/net/usb/cdc_ncm.c:1090:32: warning: incorrect type in assignment (different base types)
drivers/net/usb/cdc_ncm.c:1090:32: expected unsigned short [unsigned] [usertype] connected
drivers/net/usb/cdc_ncm.c:1090:32: got restricted __le16 [usertype] wValue

---
 drivers/net/usb/cdc_ncm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/cdc_ncm.c +1 -1
index 0ed03b1..682b17a 100644
@@ -1087,7 +1087,7 @@ static void cdc_ncm_status(struct usbnet *dev, struct urb *urb)
 		 * USB_CDC_NOTIFY_NETWORK_CONNECTION notification shall be
 		 * sent by device after USB_CDC_NOTIFY_SPEED_CHANGE.
 		 */
-		ctx->connected = event->wValue;
+		ctx->connected = le16_to_cpu(event->wValue);
 
 		printk(KERN_INFO KBUILD_MODNAME ": %s: network connection:"
 			" %sconnected\n",
Signature · 6 lines
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#6 lore raw

PATCH 1/1 net: cdc_ncm: error path lock fix

In reply to Bjørn Mork

Fixes the sparse warning

drivers/net/usb/cdc_ncm.c:836:9: warning: context imbalance in 'cdc_ncm_txpath_bh' - different lock contexts for basic block

---
 drivers/net/usb/cdc_ncm.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/net/usb/cdc_ncm.c +2 -0
index 682b17a..11370fe 100644
@@ -842,6 +842,8 @@ static void cdc_ncm_txpath_bh(unsigned long param)
 		netif_tx_lock_bh(ctx->netdev);
 		usbnet_start_xmit(NULL, ctx->netdev);
 		netif_tx_unlock_bh(ctx->netdev);
+	} else {
+		spin_unlock_bh(&ctx->mtx);
 	}
 }
 
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH v2 1/1 net: sierra: shut up sparse restricted type warnings

In reply to a message not in the archive

Removes the warnings

drivers/net/usb/sierra_net.c:343:45: warning: incorrect type in assignment (different base types)
drivers/net/usb/sierra_net.c:343:45: expected unsigned short [unsigned] [short] [usertype] <noident>
drivers/net/usb/sierra_net.c:343:45: got restricted __be16 [usertype] <noident>

and

drivers/net/usb/sierra_net.c:658:18: warning: cast to restricted __le16

---
v2: rebased on top of the latest fixes which were just applied to net-next

 drivers/net/usb/sierra_net.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/usb/sierra_net.c +2 -2
index eb5c7a8..18dd425 100644
@@ -339,7 +339,7 @@ static void sierra_net_set_ctx_index(struct sierra_net_data *priv, u8 ctx_ix)
 	dev_dbg(&(priv->usbnet->udev->dev), "%s %d", __func__, ctx_ix);
 	priv->tx_hdr_template[0] = 0x3F;
 	priv->tx_hdr_template[1] = ctx_ix;
-	*((u16 *)&priv->tx_hdr_template[2]) =
+	*((__be16 *)&priv->tx_hdr_template[2]) =
 		cpu_to_be16(SIERRA_NET_HIP_EXT_IP_OUT_ID);
 }
 
@@ -631,7 +631,7 @@ static int sierra_net_change_mtu(struct net_device *net, int new_mtu)
 static int sierra_net_get_fw_attr(struct usbnet *dev, u16 *datap)
 {
 	int result = 0;
-	u16 attrdata;
+	__le16 attrdata;
 
 	result = usbnet_read_cmd(dev,
 				/* _u8 vendor specific request */
Signature · 6 lines
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#8 lore raw

Re: [PATCH net-next] net: cdc_ncm: error path lock fix

In reply to a message not in the archive

From: Bjørn Mork <[email protected]>
Date: Fri, 26 Oct 2012 09:44:09 +0200

Quoted 5 lines

Fixes the sparse warning

drivers/net/usb/cdc_ncm.c:836:9: warning: context imbalance in 'cdc_ncm_txpath_bh' - different lock contexts for basic block

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

maintainer Applied
#3 lore raw

Re: [PATCH net-next] net: cdc_ncm: big endian fix

In reply to Bjørn Mork

From: Bjørn Mork <[email protected]>
Date: Fri, 26 Oct 2012 09:44:08 +0200

Quoted 8 lines

Probably doesn't matter much since the value is used as a boolean anyway, but it removes the sparse warning:

drivers/net/usb/cdc_ncm.c:1090:32: warning: incorrect type in assignment (different base types)
drivers/net/usb/cdc_ncm.c:1090:32: expected unsigned short [unsigned] [usertype] connected
drivers/net/usb/cdc_ncm.c:1090:32: got restricted __le16 [usertype] wValue

Applied.

#5 lore raw
In reply to a message not in the archive

From: Bjørn Mork <[email protected]>
Date: Fri, 26 Oct 2012 09:44:07 +0200

Quoted 11 lines

Removes the warnings

drivers/net/usb/sierra_net.c:343:45: warning: incorrect type in assignment (different base types)
drivers/net/usb/sierra_net.c:343:45: expected unsigned short [unsigned] [short] [usertype] <noident>
drivers/net/usb/sierra_net.c:343:45: got restricted __be16 [usertype] <noident>

and

drivers/net/usb/sierra_net.c:658:18: warning: cast to restricted __le16

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