From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Date: Fri, 11 Sep 2020 04:19:35 +0000 Subject: Re: [trivial PATCH] treewide: Convert switch/case fallthrough; to break; Message-Id: List-Id: References: <9372456a-8dcf-2735-57a4-e126aa5df3a6@arm.com> In-Reply-To: <9372456a-8dcf-2735-57a4-e126aa5df3a6@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Robin Murphy , LKML , Jiri Kosina Cc: linux-wireless@vger.kernel.org, linux-fbdev@vger.kernel.org, oss-drivers@netronome.com, nouveau@lists.freedesktop.org, alsa-devel , dri-devel@lists.freedesktop.org, linux-ide@vger.kernel.org, dm-devel@redhat.com, linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, sparclinux@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-rtc@vger.kernel.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, dccp@vger.kernel.org, linux-rdma@vger.kernel.org, linux-atm-general@lists.sourceforge.net, linux-afs@lists.infradead.org, coreteam@netfilter.org, intel-wired-lan@lists.osuosl.org, linux-serial@vger.kernel.org, linux-input@vger.kernel.org, linux-mmc@vger.kernel.org, Kees Cook , linux-media@vger.kernel.org, linux-pm@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-sctp@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-nvme@lists.infradead.org, storagedev@microchip.com, ceph-devel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-nfs@vger.kernel.org, linux-parisc@vger.kernel.org, netdev@vger.kernel.org, linux-usb@vger.kernel.org, Nick Desaulniers , linux-mips@vger.kernel.org, iommu@lists.linux-foundation.org, netfilter-devel@vger.kernel.org, linux-crypto@vger.kernel.org, bpf@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Will Deacon On Thu, 2020-09-10 at 15:21 +0100, Robin Murphy wrote: > On 2020-09-09 21:06, Joe Perches wrote: > > fallthrough to a separate case/default label break; isn't very readable. > > > > Convert pseudo-keyword fallthrough; statements to a simple break; when > > the next label is case or default and the only statement in the next > > label block is break; > > > > Found using: > > > > $ grep-2.5.4 -rP --include=*.[ch] -n "fallthrough;(\s*(case\s+\w+|default)\s*:\s*){1,7}break;" * > > > > Miscellanea: > > > > o Move or coalesce a couple label blocks above a default: block. > > > > Signed-off-by: Joe Perches > > --- > > > > Compiled allyesconfig x86-64 only. > > A few files for other arches were not compiled. > > > > [...] > > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > > index c192544e874b..743db1abec40 100644 > > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > > @@ -3777,7 +3777,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu) > > switch (FIELD_GET(IDR0_TTF, reg)) { > > case IDR0_TTF_AARCH32_64: > > smmu->ias = 40; > > - fallthrough; > > + break; > > case IDR0_TTF_AARCH64: > > break; > > default: > > I have to say I don't really agree with the readability argument for > this one - a fallthrough is semantically correct here, since the first > case is a superset of the second. It just happens that anything we would > do for the common subset is implicitly assumed (there are other > potential cases we simply haven't added support for at the moment), thus > the second case is currently empty. > This change actively obfuscates that distinction. Then perhaps comments should be added to usefully describe the mechanisms. case IDR0_TTF_AARCH32_64: smmu->ias = 40; fallthrough; /* and still do the 64 bit processing */ case IDR0_TTF_AARCH64: /* Nothing specific yet */ break; > Robin.