RE: [PATCH net v3] can: flexcan: flexcan_get_berr_counter: don't wakeup controller if interface is down
From: Bough Chen (OSS) <hidden>
Date: 2026-09-30 06:54:42
Also in:
imx, linux-can
-----Original Message-----
From: ChunYuZhiQiang <redacted>
Sent: Wednesday, September 30, 2026 2:28 PM
To: netdev@vger.kernel.org
Cc: linux-can@vger.kernel.org; mkl@pengutronix.de; kernel@pengutronix.de;
Bough Chen (OSS) [off-list ref]; shawnguo@kernel.org;
imx@lists.linux.dev; ChunYuZhiQiang [off-list ref]
Subject: [PATCH net v3] can: flexcan: flexcan_get_berr_counter: don't wakeup
controller if interface is down
If the interface is down, the CAN controller might be powered down, the clock
disabled, and/or it's external reset asserted.
Don't wake up the controller to read the CAN bus error counters, if the
interface is down.
Fixes: ec56acfef2af1 ("can: flexcan: flexcan_get_berr_counter(): switch on
clocks before accessing ecr register")
Cc: stable@vger.kernel.org
Signed-off-by: ChunYuZhiQiang <redacted>Reviewed-by: Haibo Chen <haibo.chen@nxp.com> Regards Haibo Chen
quoted hunk ↗ jump to hunk
--- v1 -> v2: - Reword the commit message to drop the MDIS reasoning. - Add Fixes: tag. v2 -> v3: - Use the title and commit message suggested by Bough Chen. - Drop the i.MX8QXP-specific crash dump and erratum explanation; the fix addresses a generic logic problem that exists on all platforms. - Drop the m_can reference. - Drop the Link: tag (added by the maintainer at merge time). drivers/net/can/flexcan/flexcan-core.c | 3 +++ 1 file changed, 3 insertions(+)diff --git a/drivers/net/can/flexcan/flexcan-core.cb/drivers/net/can/flexcan/flexcan-core.c index 06d5d35fc1b5..b08779ee2a0a 100644--- a/drivers/net/can/flexcan/flexcan-core.c +++ b/drivers/net/can/flexcan/flexcan-core.c@@ -765,6 +765,9 @@ static int flexcan_get_berr_counter(const structnet_device *dev, const struct flexcan_priv *priv = netdev_priv(dev); int err; + if (!netif_running(dev)) + return 0; + err = pm_runtime_resume_and_get(priv->dev); if (err < 0) return err; -- 2.47.3