* [PATCH] net: hamradio: remove unused variable
@ 2018-06-17 13:03 Stefan Agner
2018-06-17 18:15 ` Joe Perches
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Agner @ 2018-06-17 13:03 UTC (permalink / raw)
To: David S. Miller; +Cc: Stefan Agner, netdev, linux-kernel
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.
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
drivers/net/hamradio/bpqether.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index f347fd9c5b28..8c9c9977241e 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -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)
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: hamradio: remove unused variable
2018-06-17 13:03 [PATCH] net: hamradio: remove unused variable Stefan Agner
@ 2018-06-17 18:15 ` Joe Perches
2018-06-17 18:57 ` Stefan Agner
0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2018-06-17 18:15 UTC (permalink / raw)
To: Stefan Agner, David S. Miller; +Cc: netdev, linux-kernel
On Sun, 2018-06-17 at 15:03 +0200, Stefan Agner wrote:
> 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.
>
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
> drivers/net/hamradio/bpqether.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
> index f347fd9c5b28..8c9c9977241e 100644
> --- a/drivers/net/hamradio/bpqether.c
> +++ b/drivers/net/hamradio/bpqether.c
> @@ -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));
Probably better to remove bcast_addr altogether and use
eth_broadcast_addr(bpq->dst_addr);
eth_broadcast_addr(bpq->acpt_addr);
>
> err = register_netdevice(ndev);
> if (err)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: hamradio: remove unused variable
2018-06-17 18:15 ` Joe Perches
@ 2018-06-17 18:57 ` Stefan Agner
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Agner @ 2018-06-17 18:57 UTC (permalink / raw)
To: Joe Perches; +Cc: David S. Miller, netdev, linux-kernel
On 17.06.2018 20:15, Joe Perches wrote:
> On Sun, 2018-06-17 at 15:03 +0200, Stefan Agner wrote:
>> 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.
>>
>> Signed-off-by: Stefan Agner <stefan@agner.ch>
>> ---
>> drivers/net/hamradio/bpqether.c | 8 +++-----
>> 1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
>> index f347fd9c5b28..8c9c9977241e 100644
>> --- a/drivers/net/hamradio/bpqether.c
>> +++ b/drivers/net/hamradio/bpqether.c
>> @@ -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));
>
> Probably better to remove bcast_addr altogether and use
>
> eth_broadcast_addr(bpq->dst_addr);
> eth_broadcast_addr(bpq->acpt_addr);
>
Sounds sensible, will send a v2.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-06-17 18:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-17 13:03 [PATCH] net: hamradio: remove unused variable Stefan Agner
2018-06-17 18:15 ` Joe Perches
2018-06-17 18:57 ` Stefan Agner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).