[OPW,kernel,v2] staging: vt6655: Fix incorrect type assignment
diff mbox

Message ID 1414580997-8594-1-git-send-email-aysemelikeyurtoglu@gmail.com
State New, archived
Headers show

Commit Message

Melike Yurtoglu Oct. 29, 2014, 11:09 a.m. UTC
This patch fixes following sparse warnings:
drivers/staging/vt6655/bssdb.c:361:35: warning: incorrect type in
assignment (different base types)
drivers/staging/vt6655/bssdb.c:361:35:    expected unsigned short
[unsigned] wBeaconInterval
drivers/staging/vt6655/bssdb.c:361:35:    got restricted __le16
[usertype] <noident>
drivers/staging/vt6655/bssdb.c:362:28: warning: incorrect type in
assignment (different base types)
drivers/staging/vt6655/bssdb.c:362:28:    expected unsigned short
[unsigned] wCapInfo
drivers/staging/vt6655/bssdb.c:362:28:    got restricted __le16
[usertype] <noident>
drivers/staging/vt6655/bssdb.c:556:35: warning: incorrect type in
assignment (different base types)
drivers/staging/vt6655/bssdb.c:556:35:    expected unsigned short
[unsigned] wBeaconInterval
drivers/staging/vt6655/bssdb.c:556:35:    got restricted __le16
[usertype] <noident>
drivers/staging/vt6655/bssdb.c:557:28: warning: incorrect type in
assignment (different base types)
drivers/staging/vt6655/bssdb.c:557:28:    expected unsigned short
[unsigned] wCapInfo
drivers/staging/vt6655/bssdb.c:557:28:    got restricted __le16
[usertype] <noident>

Signed-off-by: Melike Yurtoglu <aysemelikeyurtoglu@gmail.com>
---
v2:used __u16 

 drivers/staging/vt6655/bssdb.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Greg KH Oct. 29, 2014, 3:47 p.m. UTC | #1
On Wed, Oct 29, 2014 at 01:09:57PM +0200, Melike Yurtoglu wrote:
> This patch fixes following sparse warnings:
> drivers/staging/vt6655/bssdb.c:361:35: warning: incorrect type in
> assignment (different base types)
> drivers/staging/vt6655/bssdb.c:361:35:    expected unsigned short
> [unsigned] wBeaconInterval
> drivers/staging/vt6655/bssdb.c:361:35:    got restricted __le16
> [usertype] <noident>
> drivers/staging/vt6655/bssdb.c:362:28: warning: incorrect type in
> assignment (different base types)
> drivers/staging/vt6655/bssdb.c:362:28:    expected unsigned short
> [unsigned] wCapInfo
> drivers/staging/vt6655/bssdb.c:362:28:    got restricted __le16
> [usertype] <noident>
> drivers/staging/vt6655/bssdb.c:556:35: warning: incorrect type in
> assignment (different base types)
> drivers/staging/vt6655/bssdb.c:556:35:    expected unsigned short
> [unsigned] wBeaconInterval
> drivers/staging/vt6655/bssdb.c:556:35:    got restricted __le16
> [usertype] <noident>
> drivers/staging/vt6655/bssdb.c:557:28: warning: incorrect type in
> assignment (different base types)
> drivers/staging/vt6655/bssdb.c:557:28:    expected unsigned short
> [unsigned] wCapInfo
> drivers/staging/vt6655/bssdb.c:557:28:    got restricted __le16
> [usertype] <noident>
> 
> Signed-off-by: Melike Yurtoglu <aysemelikeyurtoglu@gmail.com>
> ---
> v2:used __u16 
> 
>  drivers/staging/vt6655/bssdb.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c
> index 996d330..43887ed 100644
> --- a/drivers/staging/vt6655/bssdb.c
> +++ b/drivers/staging/vt6655/bssdb.c
> @@ -358,8 +358,8 @@ BSSbInsertToBSSList(
>  	pBSSList->bActive = true;
>  	memcpy(pBSSList->abyBSSID, abyBSSIDAddr, WLAN_BSSID_LEN);
>  	pBSSList->qwBSSTimestamp = le64_to_cpu(qwTimestamp);
> -	pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
> -	pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
> +	pBSSList->wBeaconInterval = (__u16)wBeaconInterval;
> +	pBSSList->wCapInfo = (__u16)wCapInfo;
>  	pBSSList->uClearCount = 0;
>  
>  	if (pSSID->len > WLAN_SSID_MAXLEN)
> @@ -553,8 +553,8 @@ BSSbUpdateToBSSList(
>  		return false;
>  
>  	pBSSList->qwBSSTimestamp = le64_to_cpu(qwTimestamp);
> -	pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
> -	pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
> +	pBSSList->wBeaconInterval = (__u16)wBeaconInterval;
> +	pBSSList->wCapInfo = (__u16)wCapInfo;

You just changed the logic in the code.  You can't just delete
macros/functions for no good reason...

Do you understand what the sparse warning is telling you?  If so, how
does this change solve the real problem here?

thanks,

greg k-h

Patch
diff mbox

diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c
index 996d330..43887ed 100644
--- a/drivers/staging/vt6655/bssdb.c
+++ b/drivers/staging/vt6655/bssdb.c
@@ -358,8 +358,8 @@  BSSbInsertToBSSList(
 	pBSSList->bActive = true;
 	memcpy(pBSSList->abyBSSID, abyBSSIDAddr, WLAN_BSSID_LEN);
 	pBSSList->qwBSSTimestamp = le64_to_cpu(qwTimestamp);
-	pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
-	pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
+	pBSSList->wBeaconInterval = (__u16)wBeaconInterval;
+	pBSSList->wCapInfo = (__u16)wCapInfo;
 	pBSSList->uClearCount = 0;
 
 	if (pSSID->len > WLAN_SSID_MAXLEN)
@@ -553,8 +553,8 @@  BSSbUpdateToBSSList(
 		return false;
 
 	pBSSList->qwBSSTimestamp = le64_to_cpu(qwTimestamp);
-	pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
-	pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
+	pBSSList->wBeaconInterval = (__u16)wBeaconInterval;
+	pBSSList->wCapInfo = (__u16)wCapInfo;
 	pBSSList->uClearCount = 0;
 	pBSSList->uChannel = byCurrChannel;