Skip to contentSkip to conversation

staging: unisys: fix sparse warnings

PATCH In review Andrea Ghittino 3 participants 4 messages Mar 4, 2017 – Mar 7, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: unisys: fix sparse warnings

Sparse generates two warnings related to incorrect type in assignment. This patch changes the types in the struct defined in unisys

---
Compile tested only

 iochannel.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/unisys/include/iochannel.h +2 -2
index 54f4900..41e5b4e 100644
@@ -308,8 +308,8 @@ struct net_pkt_xmt {
 		u8 valid;	/* 1 = struct is valid - else ignore */
 		u8 hrawoffv;	/* 1 = hwrafoff is valid */
 		u8 nhrawoffv;	/* 1 = nhwrafoff is valid */
-		u16 protocol;	/* specifies packet protocol */
-		u32 csum;	/* value used to set skb->csum at IOPart */
+		__be16 protocol;	/* specifies packet protocol */
+		__wsum csum;	/* value used to set skb->csum at IOPart */
 		u32 hrawoff;	/* value used to set skb->h.raw at IOPart */
 		/* hrawoff points to the start of the TRANSPORT LAYER HEADER */
 		u32 nhrawoff;	/* value used to set skb->nh.raw at IOPart */
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines

-----Original Message-----
From: Andrea Ghittino [mailto:[email protected]]
Sent: Saturday, March 4, 2017 12:21 PM
To: [email protected]; Kershner, David A <[email protected]>; [email protected]; *S-Par- Maintainer <[email protected]>; [email protected]
Subject: [PATCH] staging: unisys: fix sparse warnings

Quoted 4 lines

Sparse generates two warnings related to incorrect type in assignment. This patch changes the types in the struct defined in unisys

Tested it on s-Par and no problems.

Quoted 23 lines

---
Compile tested only

 iochannel.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/unisys/include/iochannel.h +2 -2
index 54f4900..41e5b4e 100644
@@ -308,8 +308,8 @@ struct net_pkt_xmt {
 		u8 valid;	/* 1 = struct is valid - else ignore */
 		u8 hrawoffv;	/* 1 = hwrafoff is valid */
 		u8 nhrawoffv;	/* 1 = nhwrafoff is valid */
-		u16 protocol;	/* specifies packet protocol */
-		u32 csum;	/* value used to set skb->csum at IOPart */
+		__be16 protocol;	/* specifies packet protocol */
+		__wsum csum;	/* value used to set skb->csum at IOPart */
 		u32 hrawoff;	/* value used to set skb->h.raw at IOPart */
 		/* hrawoff points to the start of the TRANSPORT LAYER

HEADER */
u32 nhrawoff; /* value used to set skb->nh.raw at IOPart */

#2 lore raw
In reply to Andrea Ghittino
Quoted 2 lines · Andrea Ghittino

Sparse generates two warnings related to incorrect type in assignment. This patch changes the types in the struct defined in unisys

Can you post the Sparse warning? Otherwise when I'm reviewing this code I have to re-run Sparse to see what you're talking about.

regards,
dan carpenter

#3 lore raw
Quoted 9 lines · Dan Carpenter
Quoted 2 lines · Andrea Ghittino

Sparse generates two warnings related to incorrect type in assignment. This patch changes the types in the struct defined in unisys

Can you post the Sparse warning? Otherwise when I'm reviewing this code I have to re-run Sparse to see what you're talking about.

regards,
dan carpenter

Here you can find sparse warnings:

drivers/staging/unisys/visornic/visornic_main.c:844:50: warning: incorrect type in assignment (different base types)
drivers/staging/unisys/visornic/visornic_main.c:844:50: expected unsigned short [unsigned] [usertype] protocol
drivers/staging/unisys/visornic/visornic_main.c:844:50: got restricted __be16 [usertype] protocol
drivers/staging/unisys/visornic/visornic_main.c:855:46: warning: incorrect type in assignment (different base types)
drivers/staging/unisys/visornic/visornic_main.c:855:46: expected unsigned int [unsigned] [usertype] csum
drivers/staging/unisys/visornic/visornic_main.c:855:46: got restricted __wsum [usertype] csum

andrea