Bluetooth: Do not shadow hdr variable

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat Sep 29 10:59:20 EDT 2012


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=d9fc1d54f6f8123909cdee4fa98ab1ebf6c8651c
Commit:     d9fc1d54f6f8123909cdee4fa98ab1ebf6c8651c
Parent:     ab846ec4eaea1156148841b194df808ad745bbe2
Author:     Andrei Emeltchenko <andrei.emeltchenko at intel.com>
AuthorDate: Thu Jul 19 17:03:46 2012 +0300
Committer:  Gustavo Padovan <gustavo.padovan at collabora.co.uk>
CommitDate: Mon Aug 6 15:02:55 2012 -0300

    Bluetooth: Do not shadow hdr variable
    
    Fix compile warnings below:
    
    ...
    net/bluetooth/a2mp.c:505:33: warning: symbol 'hdr' shadows an earlier one
    net/bluetooth/a2mp.c:498:25: originally declared here
    ...
    
    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko at intel.com>
    Signed-off-by: Gustavo Padovan <gustavo.padovan at collabora.co.uk>
---
 net/bluetooth/a2mp.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index 57094c1..79af661 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -325,15 +325,17 @@ static inline int a2mp_cmd_rsp(struct amp_mgr *mgr, struct sk_buff *skb,
 /* Handle A2MP signalling */
 static int a2mp_chan_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb)
 {
-	struct a2mp_cmd *hdr = (void *) skb->data;
+	struct a2mp_cmd *hdr;
 	struct amp_mgr *mgr = chan->data;
 	int err = 0;
 
 	amp_mgr_get(mgr);
 
 	while (skb->len >= sizeof(*hdr)) {
-		struct a2mp_cmd *hdr = (void *) skb->data;
-		u16 len = le16_to_cpu(hdr->len);
+		u16 len;
+
+		hdr = (void *) skb->data;
+		len = le16_to_cpu(hdr->len);
 
 		BT_DBG("code 0x%2.2x id %d len %u", hdr->code, hdr->ident, len);
 
@@ -393,7 +395,9 @@ static int a2mp_chan_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb)
 
 	if (err) {
 		struct a2mp_cmd_rej rej;
+
 		rej.reason = __constant_cpu_to_le16(0);
+		hdr = (void *) skb->data;
 
 		BT_DBG("Send A2MP Rej: cmd 0x%2.2x err %d", hdr->code, err);
 



More information about the linux-mtd-cvs mailing list