* [PATCH] ieee802154: fix gcc-4.9 warnings
@ 2017-09-12 10:16 Arnd Bergmann
2017-09-12 10:24 ` Stefan Schmidt
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Arnd Bergmann @ 2017-09-12 10:16 UTC (permalink / raw)
To: Harry Morris, linuxdev, Alexander Aring, Stefan Schmidt
Cc: Arnd Bergmann, Marcel Holtmann, David S. Miller, Markus Elfring,
Gustavo A. R. Silva, Florian Westphal, Johannes Berg,
Christophe JAILLET, Colin Ian King, linux-wpan, netdev,
linux-kernel
All older compiler versions up to gcc-4.9 produce these
harmless warnings:
drivers/net/ieee802154/ca8210.c: In function 'ca8210_skb_tx':
drivers/net/ieee802154/ca8210.c:1947:9: warning: missing braces around initializer [-Wmissing-braces]
This changes the syntax to something that works on all versions
without warnings.
Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/ieee802154/ca8210.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
index 24a1eabbbc9d..e6b8ce81a6c3 100644
--- a/drivers/net/ieee802154/ca8210.c
+++ b/drivers/net/ieee802154/ca8210.c
@@ -1944,7 +1944,7 @@ static int ca8210_skb_tx(
)
{
int status;
- struct ieee802154_hdr header = { 0 };
+ struct ieee802154_hdr header = { };
struct secspec secspec;
unsigned int mac_len;
--
2.9.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ieee802154: fix gcc-4.9 warnings
2017-09-12 10:16 [PATCH] ieee802154: fix gcc-4.9 warnings Arnd Bergmann
@ 2017-09-12 10:24 ` Stefan Schmidt
2017-09-12 14:22 ` Marcel Holtmann
2017-09-12 22:34 ` Joe Perches
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Schmidt @ 2017-09-12 10:24 UTC (permalink / raw)
To: Arnd Bergmann, Harry Morris, linuxdev, Alexander Aring
Cc: Marcel Holtmann, David S. Miller, Markus Elfring,
Gustavo A. R. Silva, Florian Westphal, Johannes Berg,
Christophe JAILLET, Colin Ian King, linux-wpan, netdev,
linux-kernel
Hello.
On 09/12/2017 12:16 PM, Arnd Bergmann wrote:
> All older compiler versions up to gcc-4.9 produce these
> harmless warnings:
>
> drivers/net/ieee802154/ca8210.c: In function 'ca8210_skb_tx':
> drivers/net/ieee802154/ca8210.c:1947:9: warning: missing braces around initializer [-Wmissing-braces]
>
> This changes the syntax to something that works on all versions
> without warnings.
>
> Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/net/ieee802154/ca8210.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
> index 24a1eabbbc9d..e6b8ce81a6c3 100644
> --- a/drivers/net/ieee802154/ca8210.c
> +++ b/drivers/net/ieee802154/ca8210.c
> @@ -1944,7 +1944,7 @@ static int ca8210_skb_tx(
> )
> {
> int status;
> - struct ieee802154_hdr header = { 0 };
> + struct ieee802154_hdr header = { };
> struct secspec secspec;
> unsigned int mac_len;
>
Acked-by: Stefan Schmidt <stefan@osg.samsung.com>
regards
Stefan Schmidt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ieee802154: fix gcc-4.9 warnings
2017-09-12 10:16 [PATCH] ieee802154: fix gcc-4.9 warnings Arnd Bergmann
2017-09-12 10:24 ` Stefan Schmidt
@ 2017-09-12 14:22 ` Marcel Holtmann
2017-09-12 22:34 ` Joe Perches
2 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2017-09-12 14:22 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Harry Morris, linuxdev, Alexander Aring, Stefan Schmidt,
David S. Miller, Markus Elfring, Gustavo A. R. Silva,
Florian Westphal, Johannes Berg, Christophe JAILLET,
Colin Ian King, linux-wpan, Network Development, linux-kernel
Hi Arnd,
> All older compiler versions up to gcc-4.9 produce these
> harmless warnings:
>
> drivers/net/ieee802154/ca8210.c: In function 'ca8210_skb_tx':
> drivers/net/ieee802154/ca8210.c:1947:9: warning: missing braces around initializer [-Wmissing-braces]
>
> This changes the syntax to something that works on all versions
> without warnings.
>
> Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/net/ieee802154/ca8210.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ieee802154: fix gcc-4.9 warnings
2017-09-12 10:16 [PATCH] ieee802154: fix gcc-4.9 warnings Arnd Bergmann
2017-09-12 10:24 ` Stefan Schmidt
2017-09-12 14:22 ` Marcel Holtmann
@ 2017-09-12 22:34 ` Joe Perches
2 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2017-09-12 22:34 UTC (permalink / raw)
To: Arnd Bergmann, Harry Morris, linuxdev, Alexander Aring,
Stefan Schmidt, Andrew Morton
Cc: Marcel Holtmann, David S. Miller, Markus Elfring,
Gustavo A. R. Silva, Florian Westphal, Johannes Berg,
Christophe JAILLET, Colin Ian King, linux-wpan, netdev,
linux-kernel
On Tue, 2017-09-12 at 12:16 +0200, Arnd Bergmann wrote:
> All older compiler versions up to gcc-4.9 produce these
> harmless warnings:
>
> drivers/net/ieee802154/ca8210.c: In function 'ca8210_skb_tx':
> drivers/net/ieee802154/ca8210.c:1947:9: warning: missing braces around initializer [-Wmissing-braces]
>
> This changes the syntax to something that works on all versions
> without warnings.
>
> Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver")
[]
> diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
[]
> @@ -1944,7 +1944,7 @@ static int ca8210_skb_tx(
> )
> {
> int status;
> - struct ieee802154_hdr header = { 0 };
> + struct ieee802154_hdr header = { };
> struct secspec secspec;
> unsigned int mac_len;
Presumably gcc does this because the first member
of struct ieee802154_hdr is another struct.
I wonder if "struct foo bar = { 0 };" should be
discouraged by checkpatch.
Right now it's about 4:3 in favor of
struct foo bar = {};
over
struct foo bar = { 0 };
$ git grep -E "struct\s+\w+\s+\w+\s*=\s*\{\s*0\s*\}\s*[,;]" | wc -l
826
$ git grep -E "struct\s+\w+\s+\w+\s*=\s*\{\s*\}\s*[,;]" | wc -l
990
There are many instances on multiple lines too.
The git grep above doesn't span multiple lines.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-09-12 22:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-12 10:16 [PATCH] ieee802154: fix gcc-4.9 warnings Arnd Bergmann
2017-09-12 10:24 ` Stefan Schmidt
2017-09-12 14:22 ` Marcel Holtmann
2017-09-12 22:34 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox