diff mbox

[OPW,kernel] staging:vt6556: Fix sparse warnings of incorrect type in assignment

Message ID 20140304224932.GA27319@himangi-Inspiron-N5110gmail.com
State New, archived
Headers show

Commit Message

HIMANGI SARAOGI March 4, 2014, 10:49 p.m. UTC
This patch fixes the following sparse warnings:
drivers/staging/vt6656/rxtx.c:1294:35: warning: incorrect type in
assignment (different base types)
drivers/staging/vt6656/rxtx.c:1294:35:    expected restricted __le16
[usertype] frame_control
drivers/staging/vt6656/rxtx.c:1294:35:    got int
drivers/staging/vt6656/rxtx.c:1304:35: warning: invalid assignment: |=
drivers/staging/vt6656/rxtx.c:1304:35:    left side has type restricted
__le16
drivers/staging/vt6656/rxtx.c:1304:35:    right side has type int
drivers/staging/vt6656/rxtx.c:1326:39: warning: invalid assignment: |=
drivers/staging/vt6656/rxtx.c:1326:39:    left side has type restricted
__le16
drivers/staging/vt6656/rxtx.c:1326:39:    right side has type int
drivers/staging/vt6656/rxtx.c:1347:35: warning: invalid assignment: |=
drivers/staging/vt6656/rxtx.c:1347:35:    left side has type restricted
__le16
drivers/staging/vt6656/rxtx.c:1347:35:    right side has type int

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
---
 drivers/staging/vt6656/rxtx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul E. McKenney March 4, 2014, 10:57 p.m. UTC | #1
On Wed, Mar 05, 2014 at 04:19:33AM +0530, Himangi Saraogi wrote:
> This patch fixes the following sparse warnings:
> drivers/staging/vt6656/rxtx.c:1294:35: warning: incorrect type in
> assignment (different base types)
> drivers/staging/vt6656/rxtx.c:1294:35:    expected restricted __le16
> [usertype] frame_control
> drivers/staging/vt6656/rxtx.c:1294:35:    got int
> drivers/staging/vt6656/rxtx.c:1304:35: warning: invalid assignment: |=
> drivers/staging/vt6656/rxtx.c:1304:35:    left side has type restricted
> __le16
> drivers/staging/vt6656/rxtx.c:1304:35:    right side has type int
> drivers/staging/vt6656/rxtx.c:1326:39: warning: invalid assignment: |=
> drivers/staging/vt6656/rxtx.c:1326:39:    left side has type restricted
> __le16
> drivers/staging/vt6656/rxtx.c:1326:39:    right side has type int
> drivers/staging/vt6656/rxtx.c:1347:35: warning: invalid assignment: |=
> drivers/staging/vt6656/rxtx.c:1347:35:    left side has type restricted
> __le16
> drivers/staging/vt6656/rxtx.c:1347:35:    right side has type int
> 
> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
> ---
>  drivers/staging/vt6656/rxtx.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
> index ba0184a..7af3d0a 100644
> --- a/drivers/staging/vt6656/rxtx.c
> +++ b/drivers/staging/vt6656/rxtx.c
> @@ -1291,7 +1291,7 @@ static void s_vGenerateMACHeader(struct vnt_private *pDevice,
>  {
>  	struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyBufferAddr;
> 
> -	pMACHeader->frame_control = TYPE_802_11_DATA;
> +	pMACHeader->frame_control = cpu_to_le16(TYPE_802_11_DATA);

And the same here.  I believe that the declaration of the "frame_control"
field needs a __le16 tag.

							Thanx, Paul

> 
>      if (pDevice->op_mode == NL80211_IFTYPE_AP) {
>  	memcpy(&(pMACHeader->addr1[0]),
> -- 
> 1.7.9.5
> 
> -- 
> You received this message because you are subscribed to the Google Groups "opw-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to opw-kernel+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
HIMANGI SARAOGI March 5, 2014, 2:03 a.m. UTC | #2
On Wednesday, March 5, 2014 4:27:40 AM UTC+5:30, Paul E. McKenney wrote:
>
> On Wed, Mar 05, 2014 at 04:19:33AM +0530, Himangi Saraogi wrote: 
> > This patch fixes the following sparse warnings: 
> > drivers/staging/vt6656/rxtx.c:1294:35: warning: incorrect type in 
> > assignment (different base types) 
> > drivers/staging/vt6656/rxtx.c:1294:35:    expected restricted __le16 
> > [usertype] frame_control 
> > drivers/staging/vt6656/rxtx.c:1294:35:    got int 
> > drivers/staging/vt6656/rxtx.c:1304:35: warning: invalid assignment: |= 
> > drivers/staging/vt6656/rxtx.c:1304:35:    left side has type restricted 
> > __le16 
> > drivers/staging/vt6656/rxtx.c:1304:35:    right side has type int 
> > drivers/staging/vt6656/rxtx.c:1326:39: warning: invalid assignment: |= 
> > drivers/staging/vt6656/rxtx.c:1326:39:    left side has type restricted 
> > __le16 
> > drivers/staging/vt6656/rxtx.c:1326:39:    right side has type int 
> > drivers/staging/vt6656/rxtx.c:1347:35: warning: invalid assignment: |= 
> > drivers/staging/vt6656/rxtx.c:1347:35:    left side has type restricted 
> > __le16 
> > drivers/staging/vt6656/rxtx.c:1347:35:    right side has type int 
> > 
> > Signed-off-by: Himangi Saraogi <himan...@gmail.com <javascript:>> 
> > --- 
> >  drivers/staging/vt6656/rxtx.c |    2 +- 
> >  1 file changed, 1 insertion(+), 1 deletion(-) 
> > 
> > diff --git a/drivers/staging/vt6656/rxtx.c 
> b/drivers/staging/vt6656/rxtx.c 
> > index ba0184a..7af3d0a 100644 
> > --- a/drivers/staging/vt6656/rxtx.c 
> > +++ b/drivers/staging/vt6656/rxtx.c 
> > @@ -1291,7 +1291,7 @@ static void s_vGenerateMACHeader(struct 
> vnt_private *pDevice, 
> >  { 
> >          struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr 
> *)pbyBufferAddr; 
> > 
> > -        pMACHeader->frame_control = TYPE_802_11_DATA; 
> > +        pMACHeader->frame_control = cpu_to_le16(TYPE_802_11_DATA); 
>
> And the same here.  I believe that the declaration of the "frame_control" 
> field needs a __le16 tag. 
>
>  The struct ieee80211_hdr is defined in linux/ieee80211.h which is being 
referenced and used at many 
other instances in the tree. I think it will not be safe to change it. 
Please let me know if I can do any other 
suitable change to fix this issue.

>                                                         Thanx, Paul 
>
> > 
> >      if (pDevice->op_mode == NL80211_IFTYPE_AP) { 
> >          memcpy(&(pMACHeader->addr1[0]), 
> > -- 
> > 1.7.9.5 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "opw-kernel" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to opw-kernel+...@googlegroups.com <javascript:>. 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
>
>
Paul E. McKenney March 5, 2014, 2:57 p.m. UTC | #3
On Tue, Mar 04, 2014 at 06:03:57PM -0800, Himangi Saraogi wrote:
> 
> 
> On Wednesday, March 5, 2014 4:27:40 AM UTC+5:30, Paul E. McKenney wrote:
> >
> > On Wed, Mar 05, 2014 at 04:19:33AM +0530, Himangi Saraogi wrote: 
> > > This patch fixes the following sparse warnings: 
> > > drivers/staging/vt6656/rxtx.c:1294:35: warning: incorrect type in 
> > > assignment (different base types) 
> > > drivers/staging/vt6656/rxtx.c:1294:35:    expected restricted __le16 
> > > [usertype] frame_control 
> > > drivers/staging/vt6656/rxtx.c:1294:35:    got int 
> > > drivers/staging/vt6656/rxtx.c:1304:35: warning: invalid assignment: |= 
> > > drivers/staging/vt6656/rxtx.c:1304:35:    left side has type restricted 
> > > __le16 
> > > drivers/staging/vt6656/rxtx.c:1304:35:    right side has type int 
> > > drivers/staging/vt6656/rxtx.c:1326:39: warning: invalid assignment: |= 
> > > drivers/staging/vt6656/rxtx.c:1326:39:    left side has type restricted 
> > > __le16 
> > > drivers/staging/vt6656/rxtx.c:1326:39:    right side has type int 
> > > drivers/staging/vt6656/rxtx.c:1347:35: warning: invalid assignment: |= 
> > > drivers/staging/vt6656/rxtx.c:1347:35:    left side has type restricted 
> > > __le16 
> > > drivers/staging/vt6656/rxtx.c:1347:35:    right side has type int 
> > > 
> > > Signed-off-by: Himangi Saraogi <himan...@gmail.com <javascript:>> 
> > > --- 
> > >  drivers/staging/vt6656/rxtx.c |    2 +- 
> > >  1 file changed, 1 insertion(+), 1 deletion(-) 
> > > 
> > > diff --git a/drivers/staging/vt6656/rxtx.c 
> > b/drivers/staging/vt6656/rxtx.c 
> > > index ba0184a..7af3d0a 100644 
> > > --- a/drivers/staging/vt6656/rxtx.c 
> > > +++ b/drivers/staging/vt6656/rxtx.c 
> > > @@ -1291,7 +1291,7 @@ static void s_vGenerateMACHeader(struct 
> > vnt_private *pDevice, 
> > >  { 
> > >          struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr 
> > *)pbyBufferAddr; 
> > > 
> > > -        pMACHeader->frame_control = TYPE_802_11_DATA; 
> > > +        pMACHeader->frame_control = cpu_to_le16(TYPE_802_11_DATA); 
> >
> > And the same here.  I believe that the declaration of the "frame_control" 
> > field needs a __le16 tag. 
> >
> >  The struct ieee80211_hdr is defined in linux/ieee80211.h which is being 
> referenced and used at many 
> other instances in the tree. I think it will not be safe to change it. 
> Please let me know if I can do any other 
> suitable change to fix this issue.

My bad -- that field already does have __le16 and I misread your patch.

Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

                                                        Thanx, Paul 
> >
> > > 
> > >      if (pDevice->op_mode == NL80211_IFTYPE_AP) { 
> > >          memcpy(&(pMACHeader->addr1[0]), 
> > > -- 
> > > 1.7.9.5 
> > > 
> > > -- 
> > > You received this message because you are subscribed to the Google 
> > Groups "opw-kernel" group. 
> > > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to opw-kernel+...@googlegroups.com <javascript:>. 
> > > For more options, visit https://groups.google.com/groups/opt_out. 
> > > 
> >
> >
diff mbox

Patch

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index ba0184a..7af3d0a 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -1291,7 +1291,7 @@  static void s_vGenerateMACHeader(struct vnt_private *pDevice,
 {
 	struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyBufferAddr;
 
-	pMACHeader->frame_control = TYPE_802_11_DATA;
+	pMACHeader->frame_control = cpu_to_le16(TYPE_802_11_DATA);
 
     if (pDevice->op_mode == NL80211_IFTYPE_AP) {
 	memcpy(&(pMACHeader->addr1[0]),