This patch fixes the following sparse warning:
warning: cast to restricted __le16
Signed-off-by: simran singhal <[email protected]>
---
drivers/staging/wlan-ng/prism2sta.c | 51 ++++++++++++++++++-------------------
1 file changed, 25 insertions(+), 26 deletions(-)
diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
index 984804b..82d3a70 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -372,10 +372,9 @@ static int prism2sta_mlmerequest(struct wlandevice *wlandev,
qualmsg->noise.status =
P80211ENUM_msgitem_status_data_ok;
- qualmsg->link.data = le16_to_cpu(hw->qual.cq_curr_bss);
- qualmsg->level.data =
- le16_to_cpu(hw->qual.asl_curr_bss);
- qualmsg->noise.data = le16_to_cpu(hw->qual.anl_curr_fc);
+ qualmsg->link.data = hw->qual.cq_curr_bss;
+ qualmsg->level.data = hw->qual.asl_curr_bss;
+ qualmsg->noise.data = hw->qual.anl_curr_fc;
qualmsg->txrate.data = hw->txrate;
break;
@@ -603,10 +602,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
}
/* get all the nic id fields in host byte order */
- hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id);
- hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant);
- hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major);
- hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor);
+ hw->ident_nic.id = hw->ident_nic.id;
+ hw->ident_nic.variant = hw->ident_nic.variant;
+ hw->ident_nic.major = hw->ident_nic.major;
+ hw->ident_nic.minor = hw->ident_nic.minor;
netdev_info(wlandev->netdev, "ident: nic h/w: id=0x%02x %d.%d.%d\n",
hw->ident_nic.id, hw->ident_nic.major,
@@ -622,10 +621,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
}
/* get all the private fw id fields in host byte order */
- hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id);
- hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant);
- hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major);
- hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor);
+ hw->ident_pri_fw.id = hw->ident_pri_fw.id;
+ hw->ident_pri_fw.variant = hw->ident_pri_fw.variant;
+ hw->ident_pri_fw.major = hw->ident_pri_fw.major;
+ hw->ident_pri_fw.minor = hw->ident_pri_fw.minor;
netdev_info(wlandev->netdev, "ident: pri f/w: id=0x%02x %d.%d.%d\n",
hw->ident_pri_fw.id, hw->ident_pri_fw.major,
@@ -648,10 +647,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
}
/* get all the station fw id fields in host byte order */
- hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id);
- hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant);
- hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major);
- hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor);
+ hw->ident_sta_fw.id = hw->ident_sta_fw.id;
+ hw->ident_sta_fw.variant = hw->ident_sta_fw.variant;
+ hw->ident_sta_fw.major = hw->ident_sta_fw.major;
+ hw->ident_sta_fw.minor = hw->ident_sta_fw.minor;
/* strip out the 'special' variant bits */
hw->mm_mods = hw->ident_sta_fw.variant & GENMASK(15, 14);
@@ -683,11 +682,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
/* get all the Compatibility range, modem interface supplier
* fields in byte order
*/
- hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role);
- hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id);
- hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant);
- hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom);
- hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top);
+ hw->cap_sup_mfi.role = hw->cap_sup_mfi.role;
+ hw->cap_sup_mfi.id = hw->cap_sup_mfi.id;
+ hw->cap_sup_mfi.variant = hw->cap_sup_mfi.variant;
+ hw->cap_sup_mfi.bottom = hw->cap_sup_mfi.bottom;
+ hw->cap_sup_mfi.top = hw->cap_sup_mfi.top;
netdev_info(wlandev->netdev,
"MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
@@ -707,11 +706,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
/* get all the Compatibility range, controller interface supplier
* fields in byte order
*/
- hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role);
- hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id);
- hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant);
- hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom);
- hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top);
+ hw->cap_sup_cfi.role = hw->cap_sup_cfi.role;
+ hw->cap_sup_cfi.id = hw->cap_sup_cfi.id;
+ hw->cap_sup_cfi.variant = hw->cap_sup_cfi.variant;
+ hw->cap_sup_cfi.bottom = hw->cap_sup_cfi.bottom;
+ hw->cap_sup_cfi.top = hw->cap_sup_cfi.top;
netdev_info(wlandev->netdev,
"CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
--
2.7.4
On Thu, 2 Mar 2017, Julia Lawall wrote:
>
>
> On Thu, 2 Mar 2017, simran singhal wrote:
>
> > This patch fixes the following sparse warning:
> > warning: cast to restricted __le16
>
> You commit message should not say just fix X. What have you done to carry
> out the fix and why is this the correct approach?
This comment applies to all of the patches in the series.
julia
>
> julia
>
> >
> > Signed-off-by: simran singhal <[email protected]>
> > ---
> > drivers/staging/wlan-ng/prism2sta.c | 51 ++++++++++++++++++-------------------
> > 1 file changed, 25 insertions(+), 26 deletions(-)
> >
> > diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
> > index 984804b..82d3a70 100644
> > --- a/drivers/staging/wlan-ng/prism2sta.c
> > +++ b/drivers/staging/wlan-ng/prism2sta.c
> > @@ -372,10 +372,9 @@ static int prism2sta_mlmerequest(struct wlandevice *wlandev,
> > qualmsg->noise.status =
> > P80211ENUM_msgitem_status_data_ok;
> >
> > - qualmsg->link.data = le16_to_cpu(hw->qual.cq_curr_bss);
> > - qualmsg->level.data =
> > - le16_to_cpu(hw->qual.asl_curr_bss);
> > - qualmsg->noise.data = le16_to_cpu(hw->qual.anl_curr_fc);
> > + qualmsg->link.data = hw->qual.cq_curr_bss;
> > + qualmsg->level.data = hw->qual.asl_curr_bss;
> > + qualmsg->noise.data = hw->qual.anl_curr_fc;
> > qualmsg->txrate.data = hw->txrate;
> >
> > break;
> > @@ -603,10 +602,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> > }
> >
> > /* get all the nic id fields in host byte order */
> > - hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id);
> > - hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant);
> > - hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major);
> > - hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor);
> > + hw->ident_nic.id = hw->ident_nic.id;
> > + hw->ident_nic.variant = hw->ident_nic.variant;
> > + hw->ident_nic.major = hw->ident_nic.major;
> > + hw->ident_nic.minor = hw->ident_nic.minor;
> >
> > netdev_info(wlandev->netdev, "ident: nic h/w: id=0x%02x %d.%d.%d\n",
> > hw->ident_nic.id, hw->ident_nic.major,
> > @@ -622,10 +621,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> > }
> >
> > /* get all the private fw id fields in host byte order */
> > - hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id);
> > - hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant);
> > - hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major);
> > - hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor);
> > + hw->ident_pri_fw.id = hw->ident_pri_fw.id;
> > + hw->ident_pri_fw.variant = hw->ident_pri_fw.variant;
> > + hw->ident_pri_fw.major = hw->ident_pri_fw.major;
> > + hw->ident_pri_fw.minor = hw->ident_pri_fw.minor;
> >
> > netdev_info(wlandev->netdev, "ident: pri f/w: id=0x%02x %d.%d.%d\n",
> > hw->ident_pri_fw.id, hw->ident_pri_fw.major,
> > @@ -648,10 +647,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> > }
> >
> > /* get all the station fw id fields in host byte order */
> > - hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id);
> > - hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant);
> > - hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major);
> > - hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor);
> > + hw->ident_sta_fw.id = hw->ident_sta_fw.id;
> > + hw->ident_sta_fw.variant = hw->ident_sta_fw.variant;
> > + hw->ident_sta_fw.major = hw->ident_sta_fw.major;
> > + hw->ident_sta_fw.minor = hw->ident_sta_fw.minor;
> >
> > /* strip out the 'special' variant bits */
> > hw->mm_mods = hw->ident_sta_fw.variant & GENMASK(15, 14);
> > @@ -683,11 +682,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> > /* get all the Compatibility range, modem interface supplier
> > * fields in byte order
> > */
> > - hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role);
> > - hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id);
> > - hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant);
> > - hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom);
> > - hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top);
> > + hw->cap_sup_mfi.role = hw->cap_sup_mfi.role;
> > + hw->cap_sup_mfi.id = hw->cap_sup_mfi.id;
> > + hw->cap_sup_mfi.variant = hw->cap_sup_mfi.variant;
> > + hw->cap_sup_mfi.bottom = hw->cap_sup_mfi.bottom;
> > + hw->cap_sup_mfi.top = hw->cap_sup_mfi.top;
> >
> > netdev_info(wlandev->netdev,
> > "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
> > @@ -707,11 +706,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> > /* get all the Compatibility range, controller interface supplier
> > * fields in byte order
> > */
> > - hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role);
> > - hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id);
> > - hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant);
> > - hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom);
> > - hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top);
> > + hw->cap_sup_cfi.role = hw->cap_sup_cfi.role;
> > + hw->cap_sup_cfi.id = hw->cap_sup_cfi.id;
> > + hw->cap_sup_cfi.variant = hw->cap_sup_cfi.variant;
> > + hw->cap_sup_cfi.bottom = hw->cap_sup_cfi.bottom;
> > + hw->cap_sup_cfi.top = hw->cap_sup_cfi.top;
> >
> > netdev_info(wlandev->netdev,
> > "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
> > --
> > 2.7.4
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> > To post to this group, send email to [email protected].
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1488448146-29452-1-git-send-email-singhalsimran0%40gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1703021047350.3414%40hadrien.
> For more options, visit https://groups.google.com/d/optout.
>
drivers/staging/wlan-ng/hfa384x_usb.c:3520:34: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:3520:34: expected unsigned int [unsigned] [usertype] datarate
drivers/staging/wlan-ng/hfa384x_usb.c:3520:34: got restricted __be32 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:3521:33: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:3521:33: expected unsigned int [unsigned] [usertype] antenna
drivers/staging/wlan-ng/hfa384x_usb.c:3521:33: got restricted __be32 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:3522:34: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:3522:34: expected unsigned int [unsigned] [usertype] priority
drivers/staging/wlan-ng/hfa384x_usb.c:3522:34: got restricted __be32 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:3523:34: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:3523:34: expected unsigned int [unsigned] [usertype] ssi_type
drivers/staging/wlan-ng/hfa384x_usb.c:3523:34: got restricted __be32 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:3524:36: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:3524:36: expected signed int [signed] [usertype] [explicitly-signed] ssi_signal
drivers/staging/wlan-ng/hfa384x_usb.c:3524:36: got restricted __be32 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:3525:35: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:3525:35: expected signed int [signed] [usertype] [explicitly-signed] ssi_noise
drivers/staging/wlan-ng/hfa384x_usb.c:3525:35: got restricted __be32 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:3526:34: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:3526:34: expected unsigned int [unsigned] [usertype] preamble
drivers/staging/wlan-ng/hfa384x_usb.c:3526:34: got restricted __be32 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:3527:34: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:3527:34: expected unsigned int [unsigned] [usertype] encoding
drivers/staging/wlan-ng/hfa384x_usb.c:3527:34: got restricted __be32 [usertype] <noident>
Signed-off-by: simran singhal <[email protected]>
---
drivers/staging/wlan-ng/hfa384x_usb.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index a7ff572..cdf987b 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -3517,14 +3517,14 @@ static void hfa384x_int_rxmonitor(struct wlandevice *wlandev,
caphdr->hosttime = __cpu_to_be64(jiffies);
caphdr->phytype = htonl(4); /* dss_dot11_b */
caphdr->channel = htonl(hw->sniff_channel);
- caphdr->datarate = htonl(rxdesc->rate);
- caphdr->antenna = htonl(0); /* unknown */
- caphdr->priority = htonl(0); /* unknown */
- caphdr->ssi_type = htonl(3); /* rssi_raw */
- caphdr->ssi_signal = htonl(rxdesc->signal);
- caphdr->ssi_noise = htonl(rxdesc->silence);
- caphdr->preamble = htonl(0); /* unknown */
- caphdr->encoding = htonl(1); /* cck */
+ caphdr->datarate = be32_to_cpu(htonl(rxdesc->rate));
+ caphdr->antenna = be32_to_cpu(htonl(0)); /* unknown */
+ caphdr->priority = be32_to_cpu(htonl(0)); /* unknown */
+ caphdr->ssi_type = be32_to_cpu(htonl(3)); /* rssi_raw */
+ caphdr->ssi_signal = be32_to_cpu(htonl(rxdesc->signal));
+ caphdr->ssi_noise = be32_to_cpu(htonl(rxdesc->silence));
+ caphdr->preamble = be32_to_cpu(htonl(0)); /* unknown */
+ caphdr->encoding = be32_to_cpu(htonl(1)); /* cck */
}
/* Copy the 802.11 header to the skb
--
2.7.4
On Thu, 2 Mar 2017, SIMRAN SINGHAL wrote:
> On Thu, Mar 2, 2017 at 3:20 PM, Julia Lawall <[email protected]> wrote:
> >
> >
> > On Thu, 2 Mar 2017, Julia Lawall wrote:
> >
> >>
> >>
> >> On Thu, 2 Mar 2017, simran singhal wrote:
> >>
> >> > This patch fixes the following sparse warning:
> >> > warning: cast to restricted __le16
> >>
> >> You commit message should not say just fix X. What have you done to carry
> >> out the fix and why is this the correct approach?
> >
> > This comment applies to all of the patches in the series.
> >
> > julia
> >
> The changes and sparse warnings for them seems reasonable to me as
> after doing the
> change sparse was not showing error like cast to __le16 or something like this.
> Also it compiled perfectly.
This doesn't mean that it actually works. The function calls at least may
have been put there for a reason. Maysbe you can find other patches that
relate to this call and see what they do.
julia
> >>
> >> julia
> >>
> >> >
> >> > Signed-off-by: simran singhal <[email protected]>
> >> > ---
> >> > drivers/staging/wlan-ng/prism2sta.c | 51 ++++++++++++++++++-------------------
> >> > 1 file changed, 25 insertions(+), 26 deletions(-)
> >> >
> >> > diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
> >> > index 984804b..82d3a70 100644
> >> > --- a/drivers/staging/wlan-ng/prism2sta.c
> >> > +++ b/drivers/staging/wlan-ng/prism2sta.c
> >> > @@ -372,10 +372,9 @@ static int prism2sta_mlmerequest(struct wlandevice *wlandev,
> >> > qualmsg->noise.status =
> >> > P80211ENUM_msgitem_status_data_ok;
> >> >
> >> > - qualmsg->link.data = le16_to_cpu(hw->qual.cq_curr_bss);
> >> > - qualmsg->level.data =
> >> > - le16_to_cpu(hw->qual.asl_curr_bss);
> >> > - qualmsg->noise.data = le16_to_cpu(hw->qual.anl_curr_fc);
> >> > + qualmsg->link.data = hw->qual.cq_curr_bss;
> >> > + qualmsg->level.data = hw->qual.asl_curr_bss;
> >> > + qualmsg->noise.data = hw->qual.anl_curr_fc;
> >> > qualmsg->txrate.data = hw->txrate;
> >> >
> >> > break;
> >> > @@ -603,10 +602,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> >> > }
> >> >
> >> > /* get all the nic id fields in host byte order */
> >> > - hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id);
> >> > - hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant);
> >> > - hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major);
> >> > - hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor);
> >> > + hw->ident_nic.id = hw->ident_nic.id;
> >> > + hw->ident_nic.variant = hw->ident_nic.variant;
> >> > + hw->ident_nic.major = hw->ident_nic.major;
> >> > + hw->ident_nic.minor = hw->ident_nic.minor;
> >> >
> >> > netdev_info(wlandev->netdev, "ident: nic h/w: id=0x%02x %d.%d.%d\n",
> >> > hw->ident_nic.id, hw->ident_nic.major,
> >> > @@ -622,10 +621,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> >> > }
> >> >
> >> > /* get all the private fw id fields in host byte order */
> >> > - hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id);
> >> > - hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant);
> >> > - hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major);
> >> > - hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor);
> >> > + hw->ident_pri_fw.id = hw->ident_pri_fw.id;
> >> > + hw->ident_pri_fw.variant = hw->ident_pri_fw.variant;
> >> > + hw->ident_pri_fw.major = hw->ident_pri_fw.major;
> >> > + hw->ident_pri_fw.minor = hw->ident_pri_fw.minor;
> >> >
> >> > netdev_info(wlandev->netdev, "ident: pri f/w: id=0x%02x %d.%d.%d\n",
> >> > hw->ident_pri_fw.id, hw->ident_pri_fw.major,
> >> > @@ -648,10 +647,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> >> > }
> >> >
> >> > /* get all the station fw id fields in host byte order */
> >> > - hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id);
> >> > - hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant);
> >> > - hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major);
> >> > - hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor);
> >> > + hw->ident_sta_fw.id = hw->ident_sta_fw.id;
> >> > + hw->ident_sta_fw.variant = hw->ident_sta_fw.variant;
> >> > + hw->ident_sta_fw.major = hw->ident_sta_fw.major;
> >> > + hw->ident_sta_fw.minor = hw->ident_sta_fw.minor;
> >> >
> >> > /* strip out the 'special' variant bits */
> >> > hw->mm_mods = hw->ident_sta_fw.variant & GENMASK(15, 14);
> >> > @@ -683,11 +682,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> >> > /* get all the Compatibility range, modem interface supplier
> >> > * fields in byte order
> >> > */
> >> > - hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role);
> >> > - hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id);
> >> > - hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant);
> >> > - hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom);
> >> > - hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top);
> >> > + hw->cap_sup_mfi.role = hw->cap_sup_mfi.role;
> >> > + hw->cap_sup_mfi.id = hw->cap_sup_mfi.id;
> >> > + hw->cap_sup_mfi.variant = hw->cap_sup_mfi.variant;
> >> > + hw->cap_sup_mfi.bottom = hw->cap_sup_mfi.bottom;
> >> > + hw->cap_sup_mfi.top = hw->cap_sup_mfi.top;
> >> >
> >> > netdev_info(wlandev->netdev,
> >> > "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
> >> > @@ -707,11 +706,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> >> > /* get all the Compatibility range, controller interface supplier
> >> > * fields in byte order
> >> > */
> >> > - hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role);
> >> > - hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id);
> >> > - hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant);
> >> > - hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom);
> >> > - hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top);
> >> > + hw->cap_sup_cfi.role = hw->cap_sup_cfi.role;
> >> > + hw->cap_sup_cfi.id = hw->cap_sup_cfi.id;
> >> > + hw->cap_sup_cfi.variant = hw->cap_sup_cfi.variant;
> >> > + hw->cap_sup_cfi.bottom = hw->cap_sup_cfi.bottom;
> >> > + hw->cap_sup_cfi.top = hw->cap_sup_cfi.top;
> >> >
> >> > netdev_info(wlandev->netdev,
> >> > "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
> >> > --
> >> > 2.7.4
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> >> > To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> >> > To post to this group, send email to [email protected].
> >> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1488448146-29452-1-git-send-email-singhalsimran0%40gmail.com.
> >> > For more options, visit https://groups.google.com/d/optout.
> >> >
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> >> To post to this group, send email to [email protected].
> >> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1703021047350.3414%40hadrien.
> >> For more options, visit https://groups.google.com/d/optout.
> >>
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CALrZqyNGZcP8c9oeS65r-PRTPpwcn664iB2WvWdx3ccD5KRRLg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
On Thu, Mar 2, 2017 at 3:20 PM, Julia Lawall <[email protected]> wrote:
>
>
> On Thu, 2 Mar 2017, Julia Lawall wrote:
>
>>
>>
>> On Thu, 2 Mar 2017, simran singhal wrote:
>>
>> > This patch fixes the following sparse warning:
>> > warning: cast to restricted __le16
>>
>> You commit message should not say just fix X. What have you done to carry
>> out the fix and why is this the correct approach?
>
> This comment applies to all of the patches in the series.
>
> julia
>
The changes and sparse warnings for them seems reasonable to me as
after doing the
change sparse was not showing error like cast to __le16 or something like this.
Also it compiled perfectly.
>>
>> julia
>>
>> >
>> > Signed-off-by: simran singhal <[email protected]>
>> > ---
>> > drivers/staging/wlan-ng/prism2sta.c | 51 ++++++++++++++++++-------------------
>> > 1 file changed, 25 insertions(+), 26 deletions(-)
>> >
>> > diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
>> > index 984804b..82d3a70 100644
>> > --- a/drivers/staging/wlan-ng/prism2sta.c
>> > +++ b/drivers/staging/wlan-ng/prism2sta.c
>> > @@ -372,10 +372,9 @@ static int prism2sta_mlmerequest(struct wlandevice *wlandev,
>> > qualmsg->noise.status =
>> > P80211ENUM_msgitem_status_data_ok;
>> >
>> > - qualmsg->link.data = le16_to_cpu(hw->qual.cq_curr_bss);
>> > - qualmsg->level.data =
>> > - le16_to_cpu(hw->qual.asl_curr_bss);
>> > - qualmsg->noise.data = le16_to_cpu(hw->qual.anl_curr_fc);
>> > + qualmsg->link.data = hw->qual.cq_curr_bss;
>> > + qualmsg->level.data = hw->qual.asl_curr_bss;
>> > + qualmsg->noise.data = hw->qual.anl_curr_fc;
>> > qualmsg->txrate.data = hw->txrate;
>> >
>> > break;
>> > @@ -603,10 +602,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
>> > }
>> >
>> > /* get all the nic id fields in host byte order */
>> > - hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id);
>> > - hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant);
>> > - hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major);
>> > - hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor);
>> > + hw->ident_nic.id = hw->ident_nic.id;
>> > + hw->ident_nic.variant = hw->ident_nic.variant;
>> > + hw->ident_nic.major = hw->ident_nic.major;
>> > + hw->ident_nic.minor = hw->ident_nic.minor;
>> >
>> > netdev_info(wlandev->netdev, "ident: nic h/w: id=0x%02x %d.%d.%d\n",
>> > hw->ident_nic.id, hw->ident_nic.major,
>> > @@ -622,10 +621,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
>> > }
>> >
>> > /* get all the private fw id fields in host byte order */
>> > - hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id);
>> > - hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant);
>> > - hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major);
>> > - hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor);
>> > + hw->ident_pri_fw.id = hw->ident_pri_fw.id;
>> > + hw->ident_pri_fw.variant = hw->ident_pri_fw.variant;
>> > + hw->ident_pri_fw.major = hw->ident_pri_fw.major;
>> > + hw->ident_pri_fw.minor = hw->ident_pri_fw.minor;
>> >
>> > netdev_info(wlandev->netdev, "ident: pri f/w: id=0x%02x %d.%d.%d\n",
>> > hw->ident_pri_fw.id, hw->ident_pri_fw.major,
>> > @@ -648,10 +647,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
>> > }
>> >
>> > /* get all the station fw id fields in host byte order */
>> > - hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id);
>> > - hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant);
>> > - hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major);
>> > - hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor);
>> > + hw->ident_sta_fw.id = hw->ident_sta_fw.id;
>> > + hw->ident_sta_fw.variant = hw->ident_sta_fw.variant;
>> > + hw->ident_sta_fw.major = hw->ident_sta_fw.major;
>> > + hw->ident_sta_fw.minor = hw->ident_sta_fw.minor;
>> >
>> > /* strip out the 'special' variant bits */
>> > hw->mm_mods = hw->ident_sta_fw.variant & GENMASK(15, 14);
>> > @@ -683,11 +682,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
>> > /* get all the Compatibility range, modem interface supplier
>> > * fields in byte order
>> > */
>> > - hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role);
>> > - hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id);
>> > - hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant);
>> > - hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom);
>> > - hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top);
>> > + hw->cap_sup_mfi.role = hw->cap_sup_mfi.role;
>> > + hw->cap_sup_mfi.id = hw->cap_sup_mfi.id;
>> > + hw->cap_sup_mfi.variant = hw->cap_sup_mfi.variant;
>> > + hw->cap_sup_mfi.bottom = hw->cap_sup_mfi.bottom;
>> > + hw->cap_sup_mfi.top = hw->cap_sup_mfi.top;
>> >
>> > netdev_info(wlandev->netdev,
>> > "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
>> > @@ -707,11 +706,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
>> > /* get all the Compatibility range, controller interface supplier
>> > * fields in byte order
>> > */
>> > - hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role);
>> > - hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id);
>> > - hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant);
>> > - hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom);
>> > - hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top);
>> > + hw->cap_sup_cfi.role = hw->cap_sup_cfi.role;
>> > + hw->cap_sup_cfi.id = hw->cap_sup_cfi.id;
>> > + hw->cap_sup_cfi.variant = hw->cap_sup_cfi.variant;
>> > + hw->cap_sup_cfi.bottom = hw->cap_sup_cfi.bottom;
>> > + hw->cap_sup_cfi.top = hw->cap_sup_cfi.top;
>> >
>> > netdev_info(wlandev->netdev,
>> > "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
>> > --
>> > 2.7.4
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
>> > To post to this group, send email to [email protected].
>> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1488448146-29452-1-git-send-email-singhalsimran0%40gmail.com.
>> > For more options, visit https://groups.google.com/d/optout.
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1703021047350.3414%40hadrien.
>> For more options, visit https://groups.google.com/d/optout.
>>
drivers/staging/fbtft/fbtft-bus.c:166:36: warning: incorrect type in assignment (different base types)
drivers/staging/fbtft/fbtft-bus.c:166:36: expected unsigned short [unsigned] [short] [usertype] <noident>
drivers/staging/fbtft/fbtft-bus.c:166:36: got restricted __be16 [usertype] <noident>
drivers/staging/fbtft/fbtft-io.c:74:29: warning: incorrect type in assignment (different base types)
drivers/staging/fbtft/fbtft-io.c:74:29: expected unsigned long long [unsigned] [long] [long long] [usertype] <noident>
drivers/staging/fbtft/fbtft-io.c:74:29: got restricted __be64 [usertype] <noident>
Signed-off-by: simran singhal <[email protected]>
---
drivers/staging/fbtft/fbtft-bus.c | 2 +-
drivers/staging/fbtft/fbtft-io.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/fbtft/fbtft-bus.c b/drivers/staging/fbtft/fbtft-bus.c
index ec45043..df2223e 100644
--- a/drivers/staging/fbtft/fbtft-bus.c
+++ b/drivers/staging/fbtft/fbtft-bus.c
@@ -163,7 +163,7 @@ int fbtft_write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len)
to_copy, remain - to_copy);
for (i = 0; i < to_copy; i++)
- txbuf16[i] = cpu_to_be16(vmem16[i]);
+ txbuf16[i] = vmem16[i];
vmem16 = vmem16 + to_copy;
ret = par->fbtftops.write(par, par->txbuf.buf,
diff --git a/drivers/staging/fbtft/fbtft-io.c b/drivers/staging/fbtft/fbtft-io.c
index d868405..ffb9a3b 100644
--- a/drivers/staging/fbtft/fbtft-io.c
+++ b/drivers/staging/fbtft/fbtft-io.c
@@ -71,7 +71,7 @@ int fbtft_write_spi_emulate_9(struct fbtft_par *par, void *buf, size_t len)
src++;
}
tmp |= ((*src & 0x0100) ? 1 : 0);
- *(u64 *)dst = cpu_to_be64(tmp);
+ *(__be64 *)dst = cpu_to_be64(tmp);
dst += 8;
*dst++ = (u8)(*src++ & 0x00FF);
added++;
--
2.7.4
On Thu, 2 Mar 2017, simran singhal wrote:
> This patch fixes the following sparse warning:
> warning: cast to restricted __le16
You commit message should not say just fix X. What have you done to carry
out the fix and why is this the correct approach?
julia
>
> Signed-off-by: simran singhal <[email protected]>
> ---
> drivers/staging/wlan-ng/prism2sta.c | 51 ++++++++++++++++++-------------------
> 1 file changed, 25 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
> index 984804b..82d3a70 100644
> --- a/drivers/staging/wlan-ng/prism2sta.c
> +++ b/drivers/staging/wlan-ng/prism2sta.c
> @@ -372,10 +372,9 @@ static int prism2sta_mlmerequest(struct wlandevice *wlandev,
> qualmsg->noise.status =
> P80211ENUM_msgitem_status_data_ok;
>
> - qualmsg->link.data = le16_to_cpu(hw->qual.cq_curr_bss);
> - qualmsg->level.data =
> - le16_to_cpu(hw->qual.asl_curr_bss);
> - qualmsg->noise.data = le16_to_cpu(hw->qual.anl_curr_fc);
> + qualmsg->link.data = hw->qual.cq_curr_bss;
> + qualmsg->level.data = hw->qual.asl_curr_bss;
> + qualmsg->noise.data = hw->qual.anl_curr_fc;
> qualmsg->txrate.data = hw->txrate;
>
> break;
> @@ -603,10 +602,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> }
>
> /* get all the nic id fields in host byte order */
> - hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id);
> - hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant);
> - hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major);
> - hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor);
> + hw->ident_nic.id = hw->ident_nic.id;
> + hw->ident_nic.variant = hw->ident_nic.variant;
> + hw->ident_nic.major = hw->ident_nic.major;
> + hw->ident_nic.minor = hw->ident_nic.minor;
>
> netdev_info(wlandev->netdev, "ident: nic h/w: id=0x%02x %d.%d.%d\n",
> hw->ident_nic.id, hw->ident_nic.major,
> @@ -622,10 +621,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> }
>
> /* get all the private fw id fields in host byte order */
> - hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id);
> - hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant);
> - hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major);
> - hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor);
> + hw->ident_pri_fw.id = hw->ident_pri_fw.id;
> + hw->ident_pri_fw.variant = hw->ident_pri_fw.variant;
> + hw->ident_pri_fw.major = hw->ident_pri_fw.major;
> + hw->ident_pri_fw.minor = hw->ident_pri_fw.minor;
>
> netdev_info(wlandev->netdev, "ident: pri f/w: id=0x%02x %d.%d.%d\n",
> hw->ident_pri_fw.id, hw->ident_pri_fw.major,
> @@ -648,10 +647,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> }
>
> /* get all the station fw id fields in host byte order */
> - hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id);
> - hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant);
> - hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major);
> - hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor);
> + hw->ident_sta_fw.id = hw->ident_sta_fw.id;
> + hw->ident_sta_fw.variant = hw->ident_sta_fw.variant;
> + hw->ident_sta_fw.major = hw->ident_sta_fw.major;
> + hw->ident_sta_fw.minor = hw->ident_sta_fw.minor;
>
> /* strip out the 'special' variant bits */
> hw->mm_mods = hw->ident_sta_fw.variant & GENMASK(15, 14);
> @@ -683,11 +682,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> /* get all the Compatibility range, modem interface supplier
> * fields in byte order
> */
> - hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role);
> - hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id);
> - hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant);
> - hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom);
> - hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top);
> + hw->cap_sup_mfi.role = hw->cap_sup_mfi.role;
> + hw->cap_sup_mfi.id = hw->cap_sup_mfi.id;
> + hw->cap_sup_mfi.variant = hw->cap_sup_mfi.variant;
> + hw->cap_sup_mfi.bottom = hw->cap_sup_mfi.bottom;
> + hw->cap_sup_mfi.top = hw->cap_sup_mfi.top;
>
> netdev_info(wlandev->netdev,
> "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
> @@ -707,11 +706,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> /* get all the Compatibility range, controller interface supplier
> * fields in byte order
> */
> - hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role);
> - hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id);
> - hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant);
> - hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom);
> - hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top);
> + hw->cap_sup_cfi.role = hw->cap_sup_cfi.role;
> + hw->cap_sup_cfi.id = hw->cap_sup_cfi.id;
> + hw->cap_sup_cfi.variant = hw->cap_sup_cfi.variant;
> + hw->cap_sup_cfi.bottom = hw->cap_sup_cfi.bottom;
> + hw->cap_sup_cfi.top = hw->cap_sup_cfi.top;
>
> netdev_info(wlandev->netdev,
> "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1488448146-29452-1-git-send-email-singhalsimran0%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
This patch fixes the following Sparse warnings:-
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16
Signed-off-by: simran singhal <[email protected]>
---
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
index 4d6c928..713f1d6 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
@@ -174,7 +174,7 @@ static inline u16 Mk16(u8 hi, u8 lo)
static inline u16 Mk16_le(u16 *v)
{
- return le16_to_cpu(*v);
+ return *v;
}
--
2.7.4
This patch fixes the following sparse warnings:
drivers/staging/wlan-ng/hfa384x_usb.c:1327:34: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:1327:34: expected unsigned short [unsigned] [usertype] type
drivers/staging/wlan-ng/hfa384x_usb.c:1327:34: got restricted __le16 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:1328:33: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:1328:33: expected unsigned short [unsigned] [usertype] cmd
drivers/staging/wlan-ng/hfa384x_usb.c:1328:33: got restricted __le16 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:1329:35: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:1329:35: expected unsigned short [unsigned] [usertype] parm0
drivers/staging/wlan-ng/hfa384x_usb.c:1329:35: got restricted __le16 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:1330:35: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:1330:35: expected unsigned short [unsigned] [usertype] parm1
drivers/staging/wlan-ng/hfa384x_usb.c:1330:35: got restricted __le16 [usertype] <noident>
drivers/staging/wlan-ng/hfa384x_usb.c:1331:35: warning: incorrect type in assignment (different base types)
drivers/staging/wlan-ng/hfa384x_usb.c:1331:35: expected unsigned short [unsigned] [usertype] parm2
drivers/staging/wlan-ng/hfa384x_usb.c:1331:35: got restricted __le16 [usertype] <noident>
Signed-off-by: simran singhal <[email protected]>
---
drivers/staging/wlan-ng/hfa384x_usb.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index 6134eba..a7ff572 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -1324,11 +1324,11 @@ hfa384x_docmd(struct hfa384x *hw,
}
/* Initialize the command */
- ctlx->outbuf.cmdreq.type = cpu_to_le16(HFA384x_USB_CMDREQ);
- ctlx->outbuf.cmdreq.cmd = cpu_to_le16(cmd->cmd);
- ctlx->outbuf.cmdreq.parm0 = cpu_to_le16(cmd->parm0);
- ctlx->outbuf.cmdreq.parm1 = cpu_to_le16(cmd->parm1);
- ctlx->outbuf.cmdreq.parm2 = cpu_to_le16(cmd->parm2);
+ ctlx->outbuf.cmdreq.type = HFA384x_USB_CMDREQ;
+ ctlx->outbuf.cmdreq.cmd = cmd->cmd;
+ ctlx->outbuf.cmdreq.parm0 = cmd->parm0;
+ ctlx->outbuf.cmdreq.parm1 = cmd->parm1;
+ ctlx->outbuf.cmdreq.parm2 = cmd->parm2;
ctlx->outbufsize = sizeof(ctlx->outbuf.cmdreq);
--
2.7.4
On Thu, Mar 02, 2017 at 12:14:40PM +0100, Julia Lawall wrote:
>
>
> On Thu, 2 Mar 2017, SIMRAN SINGHAL wrote:
>
> > On Thu, Mar 2, 2017 at 3:20 PM, Julia Lawall <[email protected]> wrote:
> > >
> > >
> > > On Thu, 2 Mar 2017, Julia Lawall wrote:
> > >
> > >>
> > >>
> > >> On Thu, 2 Mar 2017, simran singhal wrote:
> > >>
> > >> > This patch fixes the following sparse warning:
> > >> > warning: cast to restricted __le16
> > >>
> > >> You commit message should not say just fix X. What have you done to carry
> > >> out the fix and why is this the correct approach?
> > >
> > > This comment applies to all of the patches in the series.
> > >
> > > julia
> > >
> > The changes and sparse warnings for them seems reasonable to me as
> > after doing the
> > change sparse was not showing error like cast to __le16 or something like this.
> > Also it compiled perfectly.
>
> This doesn't mean that it actually works. The function calls at least may
> have been put there for a reason. Maysbe you can find other patches that
> relate to this call and see what they do.
>
> julia
Hi Simran,
Just following on Julia's feedback and I see you've gotten
a message that this breaks little endian machines.
Good for you for trying to go deeper. I'd suggest taking this one
at a time and figure out what is going on with one of them. As Julia
says, with this kind of change, you will have to prove why it is
correct. (You might not be able to change any of these - I don't know,
but I know you'll learn something!)
Look here - and then pick one to trace through -
https://kernelnewbies.org/EndianIssues
Generally - probably best to test the waters with something of this
type, with a single patch. Get that nailed, then move onto a patchset,
if you have a pattern.
Heads down & good luck!
alisons
>
>
> > >>
> > >> julia
> > >>
> > >> >
> > >> > Signed-off-by: simran singhal <[email protected]>
> > >> > ---
> > >> > drivers/staging/wlan-ng/prism2sta.c | 51 ++++++++++++++++++-------------------
> > >> > 1 file changed, 25 insertions(+), 26 deletions(-)
> > >> >
> > >> > diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
> > >> > index 984804b..82d3a70 100644
> > >> > --- a/drivers/staging/wlan-ng/prism2sta.c
> > >> > +++ b/drivers/staging/wlan-ng/prism2sta.c
> > >> > @@ -372,10 +372,9 @@ static int prism2sta_mlmerequest(struct wlandevice *wlandev,
> > >> > qualmsg->noise.status =
> > >> > P80211ENUM_msgitem_status_data_ok;
> > >> >
> > >> > - qualmsg->link.data = le16_to_cpu(hw->qual.cq_curr_bss);
> > >> > - qualmsg->level.data =
> > >> > - le16_to_cpu(hw->qual.asl_curr_bss);
> > >> > - qualmsg->noise.data = le16_to_cpu(hw->qual.anl_curr_fc);
> > >> > + qualmsg->link.data = hw->qual.cq_curr_bss;
> > >> > + qualmsg->level.data = hw->qual.asl_curr_bss;
> > >> > + qualmsg->noise.data = hw->qual.anl_curr_fc;
> > >> > qualmsg->txrate.data = hw->txrate;
> > >> >
> > >> > break;
> > >> > @@ -603,10 +602,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> > >> > }
> > >> >
> > >> > /* get all the nic id fields in host byte order */
> > >> > - hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id);
> > >> > - hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant);
> > >> > - hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major);
> > >> > - hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor);
> > >> > + hw->ident_nic.id = hw->ident_nic.id;
> > >> > + hw->ident_nic.variant = hw->ident_nic.variant;
> > >> > + hw->ident_nic.major = hw->ident_nic.major;
> > >> > + hw->ident_nic.minor = hw->ident_nic.minor;
> > >> >
> > >> > netdev_info(wlandev->netdev, "ident: nic h/w: id=0x%02x %d.%d.%d\n",
> > >> > hw->ident_nic.id, hw->ident_nic.major,
> > >> > @@ -622,10 +621,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> > >> > }
> > >> >
> > >> > /* get all the private fw id fields in host byte order */
> > >> > - hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id);
> > >> > - hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant);
> > >> > - hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major);
> > >> > - hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor);
> > >> > + hw->ident_pri_fw.id = hw->ident_pri_fw.id;
> > >> > + hw->ident_pri_fw.variant = hw->ident_pri_fw.variant;
> > >> > + hw->ident_pri_fw.major = hw->ident_pri_fw.major;
> > >> > + hw->ident_pri_fw.minor = hw->ident_pri_fw.minor;
> > >> >
> > >> > netdev_info(wlandev->netdev, "ident: pri f/w: id=0x%02x %d.%d.%d\n",
> > >> > hw->ident_pri_fw.id, hw->ident_pri_fw.major,
> > >> > @@ -648,10 +647,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> > >> > }
> > >> >
> > >> > /* get all the station fw id fields in host byte order */
> > >> > - hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id);
> > >> > - hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant);
> > >> > - hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major);
> > >> > - hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor);
> > >> > + hw->ident_sta_fw.id = hw->ident_sta_fw.id;
> > >> > + hw->ident_sta_fw.variant = hw->ident_sta_fw.variant;
> > >> > + hw->ident_sta_fw.major = hw->ident_sta_fw.major;
> > >> > + hw->ident_sta_fw.minor = hw->ident_sta_fw.minor;
> > >> >
> > >> > /* strip out the 'special' variant bits */
> > >> > hw->mm_mods = hw->ident_sta_fw.variant & GENMASK(15, 14);
> > >> > @@ -683,11 +682,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> > >> > /* get all the Compatibility range, modem interface supplier
> > >> > * fields in byte order
> > >> > */
> > >> > - hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role);
> > >> > - hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id);
> > >> > - hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant);
> > >> > - hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom);
> > >> > - hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top);
> > >> > + hw->cap_sup_mfi.role = hw->cap_sup_mfi.role;
> > >> > + hw->cap_sup_mfi.id = hw->cap_sup_mfi.id;
> > >> > + hw->cap_sup_mfi.variant = hw->cap_sup_mfi.variant;
> > >> > + hw->cap_sup_mfi.bottom = hw->cap_sup_mfi.bottom;
> > >> > + hw->cap_sup_mfi.top = hw->cap_sup_mfi.top;
> > >> >
> > >> > netdev_info(wlandev->netdev,
> > >> > "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
> > >> > @@ -707,11 +706,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
> > >> > /* get all the Compatibility range, controller interface supplier
> > >> > * fields in byte order
> > >> > */
> > >> > - hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role);
> > >> > - hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id);
> > >> > - hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant);
> > >> > - hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom);
> > >> > - hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top);
> > >> > + hw->cap_sup_cfi.role = hw->cap_sup_cfi.role;
> > >> > + hw->cap_sup_cfi.id = hw->cap_sup_cfi.id;
> > >> > + hw->cap_sup_cfi.variant = hw->cap_sup_cfi.variant;
> > >> > + hw->cap_sup_cfi.bottom = hw->cap_sup_cfi.bottom;
> > >> > + hw->cap_sup_cfi.top = hw->cap_sup_cfi.top;
> > >> >
> > >> > netdev_info(wlandev->netdev,
> > >> > "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
> > >> > --
> > >> > 2.7.4
> > >> >
> > >> > --
> > >> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > >> > To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> > >> > To post to this group, send email to [email protected].
> > >> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1488448146-29452-1-git-send-email-singhalsimran0%40gmail.com.
> > >> > For more options, visit https://groups.google.com/d/optout.
> > >> >
> > >>
> > >> --
> > >> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > >> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> > >> To post to this group, send email to [email protected].
> > >> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1703021047350.3414%40hadrien.
> > >> For more options, visit https://groups.google.com/d/optout.
> > >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> > To post to this group, send email to [email protected].
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CALrZqyNGZcP8c9oeS65r-PRTPpwcn664iB2WvWdx3ccD5KRRLg%40mail.gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1703021213050.3414%40hadrien.
> For more options, visit https://groups.google.com/d/optout.
This patch fixes the following Sparse warning-
drivers/staging/rtl8192u/r8192U_dm.c:2307:49: warning: cast from restricted __le16
drivers/staging/rtl8192u/r8192U_dm.c:2308:44: warning: cast from restricted __le16
drivers/staging/rtl8192u/r8192U_dm.c:2309:44: warning: cast from restricted __le16
And added space before '|'
Signed-off-by: simran singhal <[email protected]>
---
drivers/staging/rtl8192u/r8192U_dm.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
index 9209aad..e1c83a3 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -2304,9 +2304,9 @@ static void dm_check_edca_turbo(
/* For Each time updating EDCA parameter, reset EDCA turbo mode status. */
dm_init_edca_turbo(dev);
u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime;
- u4bAcParam = (((u32)(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)|
- (((u32)(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET)|
- (((u32)(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET)|
+ u4bAcParam = ((le16_to_cpu(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET) |
+ ((le16_to_cpu(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET) |
+ ((le16_to_cpu(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET) |
((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET);
/*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/
write_nic_dword(dev, EDCAPARA_BE, u4bAcParam);
--
2.7.4