lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0f56d1fe577707e7804386592e1a5579bfd3abbf.camel@perches.com>
Date:   Mon, 05 Aug 2019 12:15:01 -0700
From:   Joe Perches <joe@...ches.com>
To:     "Gustavo A. R. Silva" <gustavo@...eddedor.com>,
        Ralf Baechle <ralf@...ux-mips.org>,
        Paul Burton <paul.burton@...s.com>,
        James Hogan <jhogan@...nel.org>,
        Florian Fainelli <f.fainelli@...il.com>,
        bcm-kernel-feedback-list@...adcom.com
Cc:     linux-mips@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] MIPS: BCM63XX: Mark expected switch fall-through

On Mon, 2019-08-05 at 13:55 -0500, Gustavo A. R. Silva wrote:
> Mark switch cases where we are expecting to fall through.
> 
> This patch fixes the following warning (Building: bcm63xx_defconfig mips):
> 
> arch/mips/pci/ops-bcm63xx.c: In function ‘bcm63xx_pcie_can_access’:
> arch/mips/pci/ops-bcm63xx.c:474:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    if (PCI_SLOT(devfn) == 0)
>       ^
> arch/mips/pci/ops-bcm63xx.c:477:2: note: here
>   default:
>   ^~~~~~~
> 
> Signed-off-by: Gustavo A. R. Silva <gustavo@...eddedor.com>
> ---
>  arch/mips/pci/ops-bcm63xx.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/mips/pci/ops-bcm63xx.c b/arch/mips/pci/ops-bcm63xx.c
> index d02eb9d16b55..925c72348fb6 100644
> --- a/arch/mips/pci/ops-bcm63xx.c
> +++ b/arch/mips/pci/ops-bcm63xx.c
> @@ -474,6 +474,7 @@ static int bcm63xx_pcie_can_access(struct pci_bus *bus, int devfn)
>  		if (PCI_SLOT(devfn) == 0)
>  			return bcm_pcie_readl(PCIE_DLSTATUS_REG)
>  					& DLSTATUS_PHYLINKUP;
> +		/* else, fall through */
>  	default:
>  		return false;
>  	}

Perhaps clearer as:
---
 arch/mips/pci/ops-bcm63xx.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/mips/pci/ops-bcm63xx.c b/arch/mips/pci/ops-bcm63xx.c
index d02eb9d16b55..a5e4b1905958 100644
--- a/arch/mips/pci/ops-bcm63xx.c
+++ b/arch/mips/pci/ops-bcm63xx.c
@@ -471,12 +471,11 @@ static int bcm63xx_pcie_can_access(struct pci_bus *bus, int devfn)
 	case PCIE_BUS_BRIDGE:
 		return PCI_SLOT(devfn) == 0;
 	case PCIE_BUS_DEVICE:
-		if (PCI_SLOT(devfn) == 0)
-			return bcm_pcie_readl(PCIE_DLSTATUS_REG)
-					& DLSTATUS_PHYLINKUP;
-	default:
-		return false;
+		return PCI_SLOT(devfn) == 0 &&
+		       bcm_pcie_readl(PCIE_DLSTATUS_REG) & DLSTATUS_PHYLINKUP;
 	}
+
+	return false;
 }
 
 static int bcm63xx_pcie_read(struct pci_bus *bus, unsigned int devfn,


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ