public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Silence sparse warning
@ 2012-03-20 16:08 Andrei Emeltchenko
  2012-03-20 16:18 ` Marcel Holtmann
  0 siblings, 1 reply; 9+ messages in thread
From: Andrei Emeltchenko @ 2012-03-20 16:08 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Silence sparse warning shown below:
...
net/bluetooth/mgmt.c:448:15: warning: cast to restricted __le32
...

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/mgmt.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index b8f9016..913c6d2 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -443,9 +443,7 @@ static u16 get_uuid16(u8 *uuid128)
 			return 0;
 	}
 
-	memcpy(&val, &uuid128[12], 4);
-
-	val = le32_to_cpu(val);
+	val = get_unaligned_le32(uuid128 + 12);
 	if (val > 0xffff)
 		return 0;
 
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH] Bluetooth: Silence sparse warning
@ 2012-03-20  8:32 Andrei Emeltchenko
  2012-03-20 13:19 ` Gustavo Padovan
  2012-03-20 15:49 ` Marcel Holtmann
  0 siblings, 2 replies; 9+ messages in thread
From: Andrei Emeltchenko @ 2012-03-20  8:32 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Silence sparse warning shown below:
...
net/bluetooth/mgmt.c:448:15: warning: cast to restricted __le32
...

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/mgmt.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index b8f9016..d93f2bf 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -443,9 +443,7 @@ static u16 get_uuid16(u8 *uuid128)
 			return 0;
 	}
 
-	memcpy(&val, &uuid128[12], 4);
-
-	val = le32_to_cpu(val);
+	val = get_unaligned_le32(&uuid128[12]);
 	if (val > 0xffff)
 		return 0;
 
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH] Bluetooth: Silence sparse warning
@ 2012-03-19 11:26 Andrei Emeltchenko
  2012-03-19 17:39 ` Marcel Holtmann
  0 siblings, 1 reply; 9+ messages in thread
From: Andrei Emeltchenko @ 2012-03-19 11:26 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Silence sparse warning by introducing tmp __le variable. Despite being
short constructions like "val = le32_to_cpu(val)" are sources of
unneeded warnings (shown below)
...
net/bluetooth/mgmt.c:448:15: warning: cast to restricted __le32
...

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/mgmt.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index b8f9016..eb8cb66 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -435,6 +435,7 @@ static u8 bluetooth_base_uuid[] = {
 
 static u16 get_uuid16(u8 *uuid128)
 {
+	__le32 tmp;
 	u32 val;
 	int i;
 
@@ -443,9 +444,9 @@ static u16 get_uuid16(u8 *uuid128)
 			return 0;
 	}
 
-	memcpy(&val, &uuid128[12], 4);
+	memcpy(&tmp, &uuid128[12], 4);
 
-	val = le32_to_cpu(val);
+	val = le32_to_cpu(tmp);
 	if (val > 0xffff)
 		return 0;
 
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-03-20 16:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-20 16:08 [PATCH] Bluetooth: Silence sparse warning Andrei Emeltchenko
2012-03-20 16:18 ` Marcel Holtmann
2012-03-20 16:24   ` Andrei Emeltchenko
  -- strict thread matches above, loose matches on Subject: below --
2012-03-20  8:32 Andrei Emeltchenko
2012-03-20 13:19 ` Gustavo Padovan
2012-03-20 15:49 ` Marcel Holtmann
2012-03-19 11:26 Andrei Emeltchenko
2012-03-19 17:39 ` Marcel Holtmann
2012-03-20  8:34   ` Andrei Emeltchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox