Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3414629pxt; Tue, 10 Aug 2021 03:08:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTERTn9Qub/PLYWSd2dbsFrgFAFmFFQhDOeGImcX2nTHYeHbKTWHDyDUs/TKo5YbHxKztH X-Received: by 2002:aa7:c554:: with SMTP id s20mr4100840edr.198.1628590107147; Tue, 10 Aug 2021 03:08:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628590107; cv=none; d=google.com; s=arc-20160816; b=Fr76IZ/uSS+hK0c561TTKW4y5gmhAIufthJbRBQ7ncW5NMLiF6ZUl0g2fGJ62pR9xR FWeeIIS8XEkZiLW0JvB0tA1kXDOefsEKKsC4UKcMSZCf7ihmhEZ6xmiKM97bN9EjRQFr 8wJ5AvArxYXdS2480OmawJM9NXq4sgjdBSa8IOr0JW5Kpj20p5L4CZ2kX+NkrRDIVAlV eVFEslCJpOhCHqPCUKbyzraAY4kGrPWq1EZamAnZ7xv9fTSkhD1/ZxjUU/xYDIhAuJJu DirDQDpqsRRfgYiCRY+Tl0qZ+XODzwYVyCVPXammbtz8OeJ4y2WZCybZ8Sw+k37GpyTs hQfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8vt89Y6r+9GV+oFHjxZBGO2/Fiby2OsZ3MlYOti3J4Y=; b=lz+GWQ++iwJ15+U4/YLVQ70duYjvMfFFEEE+P9PD4AVUj4gxA9FrU6HJ7h0yIdC/qF 0bImbtRgn0a8Yp7gjukuUGb+MawBg7L93OHpZWuAdJBI3fktfCdwGXKMVB+38TwuhWHT rmAImZRHp3VAr7YzNtORZkFyPG0o4A6TGEbkTIvDhSKi7hSbPtwyuV9k4NbPDR4iRUiN 7HmsdUDlmPwJkoKDRREFDzPcgDMdIrzjpLDqDqLZKiaD1MeM1dCL7oZFg1s2a7MnUixW Vk94WdFTSlRdoJ1Ms2gjJWFw4NcRnpvOI5TmtGsiywFJ/2EHUePVT1q7NsFKewzObWuI HhrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=UugJXkM0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si20415683edv.399.2021.08.10.03.08.00; Tue, 10 Aug 2021 03:08:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=UugJXkM0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230039AbhHJJNR (ORCPT + 99 others); Tue, 10 Aug 2021 05:13:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232897AbhHJJNO (ORCPT ); Tue, 10 Aug 2021 05:13:14 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A89FC0613D3; Tue, 10 Aug 2021 02:12:50 -0700 (PDT) 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210810081616.wjx6jnlh3qxqsfm2@skbuf> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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!