[OPW,kernel,v5] Staging: btmtk_usb: Fix Sparse Warning of incorrect type in assignment
diff mbox

Message ID 1381867934-8732-1-git-send-email-rashika.kheria@gmail.com
State Accepted
Headers show

Commit Message

Rashika Oct. 15, 2013, 8:12 p.m. UTC
This patch fixes the following Sparse Warnings in btmtk_usb.c:

drivers/staging/btmtk_usb/btmtk_usb.c:676:39: warning: incorrect type in assignment (different base types)
drivers/staging/btmtk_usb/btmtk_usb.c:676:39:    expected unsigned int [unsigned] [usertype] packet_header
drivers/staging/btmtk_usb/btmtk_usb.c:676:39:    got restricted __le32 [usertype] <noident>

drivers/staging/btmtk_usb/btmtk_usb.c:736:31: warning: incorrect type in assignment (different base types)
drivers/staging/btmtk_usb/btmtk_usb.c:736:31:    expected unsigned int [unsigned] [addressable] [usertype] packet_header
drivers/staging/btmtk_usb/btmtk_usb.c:736:31:    got restricted __le32 [usertype] <noident>

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
---

This revision fixes the following issues from the previous revision-
Incorrect Variable Name

 drivers/staging/btmtk_usb/btmtk_usb.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Greg Kroah-Hartman Oct. 16, 2013, 4:34 p.m. UTC | #1
On Wed, Oct 16, 2013 at 01:42:13AM +0530, Rashika Kheria wrote:
> This patch fixes the following Sparse Warnings in btmtk_usb.c:
> 
> drivers/staging/btmtk_usb/btmtk_usb.c:676:39: warning: incorrect type in assignment (different base types)
> drivers/staging/btmtk_usb/btmtk_usb.c:676:39:    expected unsigned int [unsigned] [usertype] packet_header
> drivers/staging/btmtk_usb/btmtk_usb.c:676:39:    got restricted __le32 [usertype] <noident>
> 
> drivers/staging/btmtk_usb/btmtk_usb.c:736:31: warning: incorrect type in assignment (different base types)
> drivers/staging/btmtk_usb/btmtk_usb.c:736:31:    expected unsigned int [unsigned] [addressable] [usertype] packet_header
> drivers/staging/btmtk_usb/btmtk_usb.c:736:31:    got restricted __le32 [usertype] <noident>
> 
> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>

Thanks for the persistance in fixing this up, it's a lot smaller and (I
think) better than the original patch.

Applied, thanks.

greg k-h

Patch
diff mbox

diff --git a/drivers/staging/btmtk_usb/btmtk_usb.c b/drivers/staging/btmtk_usb/btmtk_usb.c
index cb315b5..7a9bf3b 100644
--- a/drivers/staging/btmtk_usb/btmtk_usb.c
+++ b/drivers/staging/btmtk_usb/btmtk_usb.c
@@ -566,6 +566,7 @@  static int btmtk_usb_load_fw(struct btmtk_usb_data *data)
 	void *buf;
 	u32 cur_len = 0;
 	u32 packet_header = 0;
+	__le32 packet_header_le;
 	u32 value;
 	u32 ilm_len = 0, dlm_len = 0;
 	u16 fw_ver, build_ver;
@@ -679,9 +680,9 @@  loadfw_protect:
 		if (sent_len > 0) {
 			packet_header &= ~(0xffffffff);
 			packet_header |= (sent_len << 16);
-			packet_header = cpu_to_le32(packet_header);
+			packet_header_le = cpu_to_le32(packet_header);
 
-			memmove(buf, &packet_header, 4);
+			memmove(buf, &packet_header_le, 4);
 			memmove(buf + 4, data->firmware->data + 32 + cur_len,
 					sent_len);
 
@@ -739,9 +740,9 @@  loadfw_protect:
 
 		packet_header &= ~(0xffffffff);
 		packet_header |= (sent_len << 16);
-		packet_header = cpu_to_le32(packet_header);
+		packet_header_le = cpu_to_le32(packet_header);
 
-		memmove(buf, &packet_header, 4);
+		memmove(buf, &packet_header_le, 4);
 		memmove(buf + 4,
 			data->firmware->data + 32 + ilm_len + cur_len,
 			sent_len);