[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPcyv4jkSFxMXgMABX7sDbwmq8zJO=rLX2ww3Y9Tc0VAANY8xQ@mail.gmail.com>
Date: Sat, 17 Oct 2020 14:01:22 -0700
From: Dan Williams <dan.j.williams@...el.com>
To: trix@...hat.com
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-edac@...r.kernel.org,
Linux ACPI <linux-acpi@...r.kernel.org>,
Linux-pm mailing list <linux-pm@...r.kernel.org>,
xen-devel <xen-devel@...ts.xenproject.org>,
linux-block@...r.kernel.org,
openipmi-developer@...ts.sourceforge.net,
linux-crypto <linux-crypto@...r.kernel.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
linux-power@...rohmeurope.com, linux-gpio@...r.kernel.org,
amd-gfx list <amd-gfx@...ts.freedesktop.org>,
Maling list - DRI developers
<dri-devel@...ts.freedesktop.org>, nouveau@...ts.freedesktop.org,
virtualization@...ts.linux-foundation.org,
spice-devel@...ts.freedesktop.org, linux-iio@...r.kernel.org,
linux-amlogic@...ts.infradead.org,
industrypack-devel@...ts.sourceforge.net,
"Linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
MPT-FusionLinux.pdl@...adcom.com,
linux-scsi <linux-scsi@...r.kernel.org>,
linux-mtd@...ts.infradead.org, linux-can@...r.kernel.org,
Netdev <netdev@...r.kernel.org>,
intel-wired-lan@...ts.osuosl.org, ath10k@...ts.infradead.org,
Linux Wireless List <linux-wireless@...r.kernel.org>,
linux-stm32@...md-mailman.stormreply.com, linux-nfc@...ts.01.org,
linux-nvdimm <linux-nvdimm@...ts.01.org>,
Linux PCI <linux-pci@...r.kernel.org>,
linux-samsung-soc <linux-samsung-soc@...r.kernel.org>,
platform-driver-x86@...r.kernel.org, patches@...nsource.cirrus.com,
storagedev@...rochip.com, devel@...verdev.osuosl.org,
linux-serial@...r.kernel.org, USB list <linux-usb@...r.kernel.org>,
usb-storage@...ts.one-eyed-alien.net,
linux-watchdog@...r.kernel.org, ocfs2-devel@....oracle.com,
bpf@...r.kernel.org, linux-integrity@...r.kernel.org,
linux-security-module@...r.kernel.org,
"open list:KEYS-TRUSTED" <keyrings@...r.kernel.org>,
alsa-devel@...a-project.org,
clang-built-linux <clang-built-linux@...glegroups.com>
Subject: Re: [RFC] treewide: cleanup unreachable breaks
On Sat, Oct 17, 2020 at 9:10 AM <trix@...hat.com> wrote:
>
> From: Tom Rix <trix@...hat.com>
>
> This is a upcoming change to clean up a new warning treewide.
> I am wondering if the change could be one mega patch (see below) or
> normal patch per file about 100 patches or somewhere half way by collecting
> early acks.
>
> clang has a number of useful, new warnings see
> https://clang.llvm.org/docs/DiagnosticsReference.html
>
> This change cleans up -Wunreachable-code-break
> https://clang.llvm.org/docs/DiagnosticsReference.html#wunreachable-code-break
> for 266 of 485 warnings in this week's linux-next, allyesconfig on x86_64.
>
> The method of fixing was to look for warnings where the preceding statement
> was a simple statement and by inspection made the subsequent break unneeded.
> In order of frequency these look like
>
> return and break
>
> switch (c->x86_vendor) {
> case X86_VENDOR_INTEL:
> intel_p5_mcheck_init(c);
> return 1;
> - break;
>
> goto and break
>
> default:
> operation = 0; /* make gcc happy */
> goto fail_response;
> - break;
>
> break and break
> case COLOR_SPACE_SRGB:
> /* by pass */
> REG_SET(OUTPUT_CSC_CONTROL, 0,
> OUTPUT_CSC_GRPH_MODE, 0);
> break;
> - break;
>
> The exception to the simple statement, is a switch case with a block
> and the end of block is a return
>
> struct obj_buffer *buff = r->ptr;
> return scnprintf(str, PRIV_STR_SIZE,
> "size=%u\naddr=0x%X\n", buff->size,
> buff->addr);
> }
> - break;
>
> Not considered obvious and excluded, breaks after
> multi level switches
> complicated if-else if-else blocks
> panic() or similar calls
>
> And there is an odd addition of a 'fallthrough' in drivers/tty/nozomi.c
[..]
> diff --git a/drivers/nvdimm/claim.c b/drivers/nvdimm/claim.c
> index 5a7c80053c62..2f250874b1a4 100644
> --- a/drivers/nvdimm/claim.c
> +++ b/drivers/nvdimm/claim.c
> @@ -200,11 +200,10 @@ ssize_t nd_namespace_store(struct device *dev,
> }
> break;
> default:
> len = -EBUSY;
> goto out_attach;
> - break;
> }
Acked-by: Dan Williams <dan.j.williams@...el.com>
Powered by blists - more mailing lists