Linux-MIPS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] MIPS: BCM63XX: Mark expected switch fall-through
@ 2019-08-05 18:55 Gustavo A. R. Silva
  2019-08-05 19:15 ` Joe Perches
  2019-08-06 19:22 ` Paul Burton
  0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2019-08-05 18:55 UTC (permalink / raw)
  To: Ralf Baechle, Paul Burton, James Hogan, Florian Fainelli,
	bcm-kernel-feedback-list
  Cc: linux-mips, linux-arm-kernel, linux-kernel, Gustavo A. R. Silva

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@embeddedor.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;
 	}
-- 
2.22.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] MIPS: BCM63XX: Mark expected switch fall-through
  2019-08-05 18:55 [PATCH] MIPS: BCM63XX: Mark expected switch fall-through Gustavo A. R. Silva
@ 2019-08-05 19:15 ` Joe Perches
  2019-08-06 19:22 ` Paul Burton
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2019-08-05 19:15 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Ralf Baechle, Paul Burton, James Hogan,
	Florian Fainelli, bcm-kernel-feedback-list
  Cc: linux-mips, linux-arm-kernel, linux-kernel

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@embeddedor.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,



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] MIPS: BCM63XX: Mark expected switch fall-through
  2019-08-05 18:55 [PATCH] MIPS: BCM63XX: Mark expected switch fall-through Gustavo A. R. Silva
  2019-08-05 19:15 ` Joe Perches
@ 2019-08-06 19:22 ` Paul Burton
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Burton @ 2019-08-06 19:22 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Ralf Baechle, Paul Burton, James Hogan, Florian Fainelli,
	bcm-kernel-feedback-list, linux-mips, linux-arm-kernel,
	linux-kernel, Gustavo A. R. Silva, linux-mips

Hello,

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@embeddedor.com>

Applied to mips-fixes.

Thanks,
    Paul

[ This message was auto-generated; if you believe anything is incorrect
  then please email paul.burton@mips.com to report it. ]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-05 18:55 [PATCH] MIPS: BCM63XX: Mark expected switch fall-through Gustavo A. R. Silva
2019-08-05 19:15 ` Joe Perches
2019-08-06 19:22 ` Paul Burton

Linux-MIPS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mips/0 linux-mips/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mips linux-mips/ https://lore.kernel.org/linux-mips \
		linux-mips@vger.kernel.org linux-mips@archiver.kernel.org
	public-inbox-index linux-mips


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-mips


AGPL code for this site: git clone https://public-inbox.org/ public-inbox