Skip to contentSkip to conversation

net: hamradio: remove unused variable

PATCH In review Stefan Agner 2 participants 3 messages Jun 17, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: hamradio: remove unused variable

The array bpq_eth_addr is only used to get the size of an address. Remove the array and use the size of the array bcast_addr which is actually copied.

Also constify and tidy up the bcast_addr declaration.

This fixes a warning seen with clang:
drivers/net/hamradio/bpqether.c:94:13: warning: variable 'bpq_eth_addr' is not
needed and will not be emitted [-Wunneeded-internal-declaration]

static char bpq_eth_addr[6];
            ^

1 warning generated.

---
 drivers/net/hamradio/bpqether.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/hamradio/bpqether.c +3 -5
index f347fd9c5b28..8c9c9977241e 100644
@@ -89,9 +89,7 @@
 static const char banner[] __initconst = KERN_INFO \
 	"AX.25: bpqether driver version 004\n";
 
-static char bcast_addr[6]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
-
-static char bpq_eth_addr[6];
+static const char bcast_addr[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
 
 static int bpq_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
 static int bpq_device_event(struct notifier_block *, unsigned long, void *);
@@ -501,8 +499,8 @@ static int bpq_new_device(struct net_device *edev)
 	bpq->ethdev = edev;
 	bpq->axdev = ndev;
 
-	memcpy(bpq->dest_addr, bcast_addr, sizeof(bpq_eth_addr));
-	memcpy(bpq->acpt_addr, bcast_addr, sizeof(bpq_eth_addr));
+	memcpy(bpq->dest_addr, bcast_addr, sizeof(bcast_addr));
+	memcpy(bpq->acpt_addr, bcast_addr, sizeof(bcast_addr));
 
 	err = register_netdevice(ndev);
 	if (err)
Signature · 1 line
2.17.1
#1 lore raw
Quoted 34 lines · Stefan Agner

The array bpq_eth_addr is only used to get the size of an address. Remove the array and use the size of the array bcast_addr which is actually copied.

Also constify and tidy up the bcast_addr declaration.

This fixes a warning seen with clang:
drivers/net/hamradio/bpqether.c:94:13: warning: variable 'bpq_eth_addr' is not
needed and will not be emitted [-Wunneeded-internal-declaration]

static char bpq_eth_addr[6];
            ^

1 warning generated.

---
 drivers/net/hamradio/bpqether.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/hamradio/bpqether.c +1 -3
index f347fd9c5b28..8c9c9977241e 100644
@@ -89,9 +89,7 @@
 static const char banner[] __initconst = KERN_INFO \
 	"AX.25: bpqether driver version 004\n";
 
-static char bcast_addr[6]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
-
-static char bpq_eth_addr[6];
+static const char bcast_addr[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
 
 static int bpq_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
 static int bpq_device_event(struct notifier_block *, unsigned long, void *);

drivers/net/hamradio/bpqether.c static int bpq_new_device(struct net_device *edev) · line 503

Quoted 7 lines
drivers/net/hamradio/bpqether.c +2 -2
@@ -501,8 +499,8 @@ static int bpq_new_device(struct net_device *edev)
 	bpq->ethdev = edev;
 	bpq->axdev = ndev;
 
-	memcpy(bpq->dest_addr, bcast_addr, sizeof(bpq_eth_addr));
-	memcpy(bpq->acpt_addr, bcast_addr, sizeof(bpq_eth_addr));
+	memcpy(bpq->dest_addr, bcast_addr, sizeof(bcast_addr));
+	memcpy(bpq->acpt_addr, bcast_addr, sizeof(bcast_addr));

Probably better to remove bcast_addr altogether and use

	eth_broadcast_addr(bpq->dst_addr);
	eth_broadcast_addr(bpq->acpt_addr);
Quoted 3 lines
drivers/net/hamradio/bpqether.c +0 -0
 	err = register_netdevice(ndev);
 	if (err)
#2 lore raw
Quoted 45 lines · Joe Perches
Quoted 34 lines · Stefan Agner

The array bpq_eth_addr is only used to get the size of an address. Remove the array and use the size of the array bcast_addr which is actually copied.

Also constify and tidy up the bcast_addr declaration.

This fixes a warning seen with clang:
drivers/net/hamradio/bpqether.c:94:13: warning: variable 'bpq_eth_addr' is not
needed and will not be emitted [-Wunneeded-internal-declaration]

static char bpq_eth_addr[6];
            ^

1 warning generated.

---
 drivers/net/hamradio/bpqether.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/hamradio/bpqether.c +1 -3
index f347fd9c5b28..8c9c9977241e 100644
@@ -89,9 +89,7 @@
 static const char banner[] __initconst = KERN_INFO \
 	"AX.25: bpqether driver version 004\n";
 
-static char bcast_addr[6]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
-
-static char bpq_eth_addr[6];
+static const char bcast_addr[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
 
 static int bpq_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
 static int bpq_device_event(struct notifier_block *, unsigned long, void *);

drivers/net/hamradio/bpqether.c static int bpq_new_device(struct net_device *edev) · line 503

Quoted 7 lines
drivers/net/hamradio/bpqether.c +2 -2
@@ -501,8 +499,8 @@ static int bpq_new_device(struct net_device *edev)
 	bpq->ethdev = edev;
 	bpq->axdev = ndev;
 
-	memcpy(bpq->dest_addr, bcast_addr, sizeof(bpq_eth_addr));
-	memcpy(bpq->acpt_addr, bcast_addr, sizeof(bpq_eth_addr));
+	memcpy(bpq->dest_addr, bcast_addr, sizeof(bcast_addr));
+	memcpy(bpq->acpt_addr, bcast_addr, sizeof(bcast_addr));

Probably better to remove bcast_addr altogether and use

Quoted 3 lines
	eth_broadcast_addr(bpq->dst_addr);
	eth_broadcast_addr(bpq->acpt_addr);

Sounds sensible, will send a v2.