[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1505255692.8969.2.camel@perches.com>
Date: Tue, 12 Sep 2017 15:34:52 -0700
From: Joe Perches <joe@...ches.com>
To: Arnd Bergmann <arnd@...db.de>, Harry Morris <h.morris@...coda.com>,
linuxdev@...coda.com, Alexander Aring <alex.aring@...il.com>,
Stefan Schmidt <stefan@....samsung.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Marcel Holtmann <marcel@...tmann.org>,
"David S. Miller" <davem@...emloft.net>,
Markus Elfring <elfring@...rs.sourceforge.net>,
"Gustavo A. R. Silva" <garsilva@...eddedor.com>,
Florian Westphal <fw@...len.de>,
Johannes Berg <johannes.berg@...el.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Colin Ian King <colin.king@...onical.com>,
linux-wpan@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ieee802154: fix gcc-4.9 warnings
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.
Powered by blists - more mailing lists