diff mbox series

PCI: imx6: Fix clang -Wimplicit-fallthrough in imx6_pcie_probe()

Message ID 20240301-pci-imx6-fix-clang-implicit-fallthrough-v1-1-db78c7cbb384@kernel.org (mailing list archive)
State New, archived
Headers show
Series PCI: imx6: Fix clang -Wimplicit-fallthrough in imx6_pcie_probe() | expand

Commit Message

Nathan Chancellor March 1, 2024, 5:40 p.m. UTC
Clang warns (or errors with CONFIG_WERROR=y or W=e):

  drivers/pci/controller/dwc/pci-imx6.c:1333:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
   1333 |         default:
        |         ^
  drivers/pci/controller/dwc/pci-imx6.c:1333:2: note: insert 'break;' to avoid fall-through
   1333 |         default:
        |         ^
        |         break;
  1 error generated.

Clang is a little more pedantic than GCC, which does not warn when
falling through to a case that is just break or return. Clang's version
is more in line with the kernel's own stance in deprecated.rst, which
states that all switch/case blocks must end in either break,
fallthrough, continue, goto, or return. Add the missing break to silence
the warning.

Fixes: 666a7beb942c ("PCI: imx6: Simplify reset handling by using by using *_FLAG_HAS_*_RESET")
Closes: https://github.com/ClangBuiltLinux/linux/issues/2004
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202403011431.vIVOdwob-lkp@intel.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/pci/controller/dwc/pci-imx6.c | 1 +
 1 file changed, 1 insertion(+)


---
base-commit: b73259dcd67094e883104a0390852695caf3f999
change-id: 20240301-pci-imx6-fix-clang-implicit-fallthrough-dbb6d9501f04

Best regards,
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 7cd165d03649..99a60270b26c 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -1330,6 +1330,7 @@  static int imx6_pcie_probe(struct platform_device *pdev)
 	case IMX7D:
 		if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR)
 			imx6_pcie->controller_id = 1;
+		break;
 	default:
 		break;
 	}