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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202403011431.vIVOdwob-lkp@xxxxxxxxx/
Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>
---
 drivers/pci/controller/dwc/pci-imx6.c | 1 +
 1 file changed, 1 insertion(+)

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;
 	}

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

Best regards,
-- 
Nathan Chancellor <nathan@xxxxxxxxxx>





[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux