From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CB85C432BE for ; Tue, 10 Aug 2021 09:15:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B058260F55 for ; Tue, 10 Aug 2021 09:15:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B058260F55 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AbbMFkjQm6eWjW4zpTYv0kQ6bnXKJup4OiHgOrqye5c=; b=r03+0z+NBmjUbO W5ylrcGthvUhxZP3J7/rzQpuKwk5KRUdP3r1kT4oSr91jTG+3/LGbxPU6vrtGplyEWUsqt7YkfEKy 44wwCA8IIMEbCrfkXO2k7iChZOmB5EZktIOBpSKLKfphN0LzCbOC5H/8y9MSbC88rA19JGABaCOmI iSQs0MXh7W/AM3s6wTWcs0YwGxSOmTuz4x3k7RckfSgiNzC7PDWGzP850P6nmqtBGcjy/r/zIB3B0 QPhlID83XDe7cXDNjtuwWNfU2Vgtnjn3u23KS71dLi12LyxdnPQFR8jCM9W2Y7JeWT1rApWZgT4M1 rhOoo7tlTL5A31p5jz6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDNoy-003Dxx-AX; Tue, 10 Aug 2021 09:13:16 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDNor-003Dwr-Bi for linux-arm-kernel@lists.infradead.org; Tue, 10 Aug 2021 09:13:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=8vt89Y6r+9GV+oFHjxZBGO2/Fiby2OsZ3MlYOti3J4Y=; b=UugJXkM0/kCE0nZHIyj6L438t iCcuNqHh0+zzKlCRxGss8klqt2RqaFkXhpOESSTrJxE9fbquLbrg0H7Kt6zDWE6+WT4YrMWErzNXD FD5VCM/8yqJNZP7ODUXQ+nik+cFY6xf/VAoQyPxXxYMhZR5frmK1eGn7NlWHE9mXWKFTjv8xMqUs9 t9o1fbtAaBRWx8VYdKtkb6j4LDd2eNAvjCJOnWPuplmaCdM7VZGf4RGnnfI/irfj5t5zo3UtfLaCN f9v7C+qiPBJ1ABNYQ5ey6qeKq2dgVwIOeyZpJfTQptYUpA0TFDqb88QVEOKhfEwq08hFLh3+OKvUv kyDXxh3OQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:47142) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mDNoR-0006oG-7K; Tue, 10 Aug 2021 10:12:43 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1mDNoM-00023a-V5; Tue, 10 Aug 2021 10:12:38 +0100 Date: Tue, 10 Aug 2021 10:12:38 +0100 From: Russell King - ARM Linux admin To: Vladimir Oltean Cc: Leon Romanovsky , "netdev@vger.kernel.org" , Jakub Kicinski , "David S. Miller" , Andrew Lunn , Florian Fainelli , Vivien Didelot , Vladimir Oltean , Vadym Kochan , Taras Chornyi , Saeed Mahameed , Jiri Pirko , Ido Schimmel , Lars Povlsen , Steen Hegelund , "UNGLinuxDriver@microchip.com" , Grygorii Strashko , Julian Wiedmann , Karsten Graul , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Jianbo Liu , Vlad Buslov , Bjarni Jonasson , Vignesh Raghavendra , Tobias Waldekranz , "linux-kernel@vger.kernel.org" , "linux-rdma@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-omap@vger.kernel.org" , "linux-s390@vger.kernel.org" , Ido Schimmel Subject: Re: [PATCH net] net: switchdev: zero-initialize struct switchdev_notifier_fdb_info emitted by drivers towards the bridge Message-ID: <20210810091238.GB1343@shell.armlinux.org.uk> References: <20210809131152.509092-1-vladimir.oltean@nxp.com> <20210810081616.wjx6jnlh3qxqsfm2@skbuf> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210810081616.wjx6jnlh3qxqsfm2@skbuf> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210810_021309_444537_FE89209D X-CRM114-Status: GOOD ( 16.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Aug 10, 2021 at 08:16:17AM +0000, Vladimir Oltean wrote: > Hi Leon, > > On Tue, Aug 10, 2021 at 09:50:41AM +0300, Leon Romanovsky wrote: > > > + memset(&send_info, 0, sizeof(send_info)); > > > > This can be written simpler. > > struct switchdev_notifier_fdb_info send_info = {}; > > > > In all places. > > Because the structure contains a sub-structure, I believe that a > compound literal initializer would require additional braces for the > initialization of its sub-objects too. At least I know that expressions > like that have attracted the attention of clang people in the past: > https://patchwork.ozlabs.org/project/netdev/patch/20190506202447.30907-1-natechancellor@gmail.com/ > So I went for the 'unambiguous' path. There's a difference between: struct foo bar = { 0 }; and struct foo bar = { }; The former tells the compiler that you wish to set the first member of struct foo, which will be an integer type, to zero. The latter is an empty initialiser where all members and sub-members of the structure default to a zero value. You should have no problem with the latter. You will encounter problems with the former if the first member of struct foo is not an integer type. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel