public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Surendra Patil <surendra.tux@gmail.com>
To: marcel@holtmann.org, gustavo@padovan.org,
	johan.hedberg@gmail.com, joe@perches.com
Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
	surendra.tux@gmail.com
Subject: [PATCH] drivers:bluetooth:ath3k.c Fixed sparse warning for cast to restricted __le32
Date: Tue, 25 Mar 2014 23:36:28 -0700	[thread overview]
Message-ID: <1395815788-24666-1-git-send-email-surendra.tux@gmail.com> (raw)

 To fix the sparse warning "cast to restricted __le32" marked
 "rom_version"  to __le32 instead of unsigned int in "struct ath3k_version"
 and added cpu_to_le32() for the expression assigning int value to "rom_version".
 Successfully built the module without warnings and errors on x86 machine with sparse.

Signed-off-by: Surendra Patil <surendra.tux@gmail.com>
---
 drivers/bluetooth/ath3k.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index be571fe..5564207 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -50,7 +50,7 @@
 #define ATH3K_NAME_LEN				0xFF
 
 struct ath3k_version {
-	unsigned int	rom_version;
+	__le32		rom_version;
 	unsigned int	build_version;
 	unsigned int	ram_version;
 	unsigned char	ref_clock;
@@ -375,7 +375,7 @@ static int ath3k_load_patch(struct usb_device *udev)
 		return ret;
 	}
 
-	pt_version.rom_version = *(int *)(firmware->data + firmware->size - 8);
+	pt_version.rom_version = cpu_to_le32(*(int *)(firmware->data + firmware->size - 8));
 	pt_version.build_version = *(int *)
 		(firmware->data + firmware->size - 4);
 
-- 
1.8.3.2


             reply	other threads:[~2014-03-26  6:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-26  6:36 Surendra Patil [this message]
2014-03-26  7:21 ` [PATCH] drivers:bluetooth:ath3k.c Fixed sparse warning for cast to restricted __le32 Marcel Holtmann
  -- strict thread matches above, loose matches on Subject: below --
2014-03-25  8:25 [PATCH] drivers:bluetooth:ath3k.c: " Surendra Patil
2014-03-25  8:32 ` Joe Perches
2014-03-25  8:38 ` Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1395815788-24666-1-git-send-email-surendra.tux@gmail.com \
    --to=surendra.tux@gmail.com \
    --cc=gustavo@padovan.org \
    --cc=joe@perches.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox