All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: hongxing.zhu@nxp.com, l.stach@pengutronix.de,
	lpieralisi@kernel.org,  kw@linux.com
Cc: robh@kernel.org, bhelgaas@google.com, shawnguo@kernel.org,
	 s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com,  linux-imx@nxp.com, Frank.Li@nxp.com,
	manivannan.sadhasivam@linaro.org,  p.zabel@pengutronix.de,
	linux-pci@vger.kernel.org,  linux-arm-kernel@lists.infradead.org,
	llvm@lists.linux.dev,  patches@lists.linux.dev,
	kernel test robot <lkp@intel.com>,
	 Nathan Chancellor <nathan@kernel.org>
Subject: [PATCH] PCI: imx6: Fix clang -Wimplicit-fallthrough in imx6_pcie_probe()
Date: Fri, 01 Mar 2024 10:40:01 -0700	[thread overview]
Message-ID: <20240301-pci-imx6-fix-clang-implicit-fallthrough-v1-1-db78c7cbb384@kernel.org> (raw)

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(+)

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@kernel.org>


WARNING: multiple messages have this Message-ID (diff)
From: Nathan Chancellor <nathan@kernel.org>
To: hongxing.zhu@nxp.com, l.stach@pengutronix.de,
	lpieralisi@kernel.org,  kw@linux.com
Cc: robh@kernel.org, bhelgaas@google.com, shawnguo@kernel.org,
	 s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com,  linux-imx@nxp.com, Frank.Li@nxp.com,
	manivannan.sadhasivam@linaro.org,  p.zabel@pengutronix.de,
	linux-pci@vger.kernel.org,  linux-arm-kernel@lists.infradead.org,
	llvm@lists.linux.dev,  patches@lists.linux.dev,
	kernel test robot <lkp@intel.com>,
	 Nathan Chancellor <nathan@kernel.org>
Subject: [PATCH] PCI: imx6: Fix clang -Wimplicit-fallthrough in imx6_pcie_probe()
Date: Fri, 01 Mar 2024 10:40:01 -0700	[thread overview]
Message-ID: <20240301-pci-imx6-fix-clang-implicit-fallthrough-v1-1-db78c7cbb384@kernel.org> (raw)

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(+)

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@kernel.org>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2024-03-01 17:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01 17:40 Nathan Chancellor [this message]
2024-03-01 17:40 ` [PATCH] PCI: imx6: Fix clang -Wimplicit-fallthrough in imx6_pcie_probe() Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240301-pci-imx6-fix-clang-implicit-fallthrough-v1-1-db78c7cbb384@kernel.org \
    --to=nathan@kernel.org \
    --cc=Frank.Li@nxp.com \
    --cc=bhelgaas@google.com \
    --cc=festevam@gmail.com \
    --cc=hongxing.zhu@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=kw@linux.com \
    --cc=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=p.zabel@pengutronix.de \
    --cc=patches@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.