Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751509AbdILWfD (ORCPT ); Tue, 12 Sep 2017 18:35:03 -0400 Received: from smtprelay0194.hostedemail.com ([216.40.44.194]:58905 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751105AbdILWe6 (ORCPT ); Tue, 12 Sep 2017 18:34:58 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:421:541:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3653:3865:3866:3867:3870:3871:3872:3874:4321:5007:6119:6742:7903:10004:10400:10450:10455:10848:11232:11658:11914:12043:12048:12049:12555:12691:12737:12740:12760:12895:13069:13161:13229:13311:13357:13439:14659:14721:19904:19999:21080:21220:21434:21451:21611:21627:30046:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: vein83_6511a26d3d61c X-Filterd-Recvd-Size: 2600 Message-ID: <1505255692.8969.2.camel@perches.com> Subject: Re: [PATCH] ieee802154: fix gcc-4.9 warnings From: Joe Perches To: Arnd Bergmann , Harry Morris , linuxdev@cascoda.com, 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@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 12 Sep 2017 15:34:52 -0700 In-Reply-To: <20170912101636.3811626-1-arnd@arndb.de> References: <20170912101636.3811626-1-arnd@arndb.de> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1273 Lines: 41 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.