From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: "Miquel Raynal (Schneider Electric)" <miquel.raynal@bootlin.com>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
Santhosh Kumar K <s-k6@ti.com>, Mark Brown <broonie@kernel.org>,
Sasha Levin <sashal@kernel.org>,
linux-spi@vger.kernel.org
Subject: [PATCH AUTOSEL 6.19-6.18] spi: cadence-qspi: Try hard to disable the clocks
Date: Fri, 13 Feb 2026 19:58:12 -0500 [thread overview]
Message-ID: <20260214010245.3671907-12-sashal@kernel.org> (raw)
In-Reply-To: <20260214010245.3671907-1-sashal@kernel.org>
From: "Miquel Raynal (Schneider Electric)" <miquel.raynal@bootlin.com>
[ Upstream commit 612227b392eed94a3398dc03334a84a699a82276 ]
In the remove path, we should try hard to perform all steps as we simply
cannot fail.
The "no runtime PM" quirk must only alter the state of the RPM core, but
the clocks should still be disabled if that is possible. Move the
disable call outside of the RPM quirk.
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Miquel Raynal (Schneider Electric) <miquel.raynal@bootlin.com>
Tested-by: Santhosh Kumar K <s-k6@ti.com>
Link: https://patch.msgid.link/20260122-schneider-6-19-rc1-qspi-v4-9-f9c21419a3e6@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
So the `CQSPI_DISABLE_RUNTIME_PM` quirk is used by `socfpga_qspi` (Intel
SoCFPGA platforms). These are real, deployed embedded systems.
### Stability Indicators
- **Tested-by:** Two testers: Wolfram Sang and Santhosh Kumar K — both
are known kernel contributors
- **Reviewed through proper channels:** Has a Link: to the mailing list
patch series
- **Part of a series:** The commit is "v4-9" suggesting it's patch 9 in
a series. This is a concern for dependency.
Let me check if this patch is self-contained or requires other patches
from the series.
The change itself is self-contained — it only modifies the logic of the
`cqspi_remove()` function. The `ret` variable is newly added and
initialized in this function. No new functions, types, or macros are
introduced. The change doesn't depend on other patches.
### Assessment
**What it fixes:** Clock resource leak on driver removal for platforms
with the `CQSPI_DISABLE_RUNTIME_PM` quirk (specifically SoCFPGA).
Without this fix, the QSPI clock remains enabled after driver removal,
which wastes power and can prevent proper power state transitions.
**Meets stable rules:**
- Obviously correct: Yes — the logic change is clear and straightforward
- Fixes a real bug: Yes — resource leak (clock not disabled on remove)
- Small and contained: Yes — ~6 lines in one file
- No new features: Correct — this is purely a bug fix
**Risk:** Very low. The change is minimal, the logic is straightforward,
and it has been tested by two people.
**Concern:** This is part of a larger series (patch 9 of N), but the
change itself appears self-contained. The only question is whether the
code it modifies exists in stable trees — the cadence-qspi driver and
the `CQSPI_DISABLE_RUNTIME_PM` quirk have been around for a while, so
this should apply.
This is a clear resource leak fix in the driver removal path, it's
small, tested, and low risk.
**YES**
drivers/spi/spi-cadence-quadspi.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
index b1c95b1c343fc..1ce433a8d64a5 100644
--- a/drivers/spi/spi-cadence-quadspi.c
+++ b/drivers/spi/spi-cadence-quadspi.c
@@ -2042,6 +2042,7 @@ static void cqspi_remove(struct platform_device *pdev)
const struct cqspi_driver_platdata *ddata;
struct cqspi_st *cqspi = platform_get_drvdata(pdev);
struct device *dev = &pdev->dev;
+ int ret = 0;
ddata = of_device_get_match_data(dev);
@@ -2061,8 +2062,10 @@ static void cqspi_remove(struct platform_device *pdev)
cqspi_jh7110_disable_clk(pdev, cqspi);
if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM)))
- if (pm_runtime_get_sync(&pdev->dev) >= 0)
- clk_disable(cqspi->clk);
+ ret = pm_runtime_get_sync(&pdev->dev);
+
+ if (ret >= 0)
+ clk_disable(cqspi->clk);
if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) {
pm_runtime_put_sync(&pdev->dev);
--
2.51.0
next prev parent reply other threads:[~2026-02-14 1:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260214010245.3671907-1-sashal@kernel.org>
2026-02-14 0:58 ` [PATCH AUTOSEL 6.19-6.1] spi-geni-qcom: initialize mode related registers to 0 Sasha Levin
2026-02-14 0:58 ` Sasha Levin [this message]
2026-02-14 0:58 ` [PATCH AUTOSEL 6.19-6.6] spi: spi-mem: Limit octal DTR constraints to octal DTR situations Sasha Levin
2026-02-14 0:58 ` [PATCH AUTOSEL 6.19-5.15] spi: stm32: fix Overrun issue at < 8bpw Sasha Levin
2026-02-14 0:58 ` [PATCH AUTOSEL 6.19-6.6] spi-geni-qcom: use xfer->bits_per_word for can_dma() Sasha Levin
2026-02-14 0:59 ` [PATCH AUTOSEL 6.19-6.18] spi: cadence-quadspi: Parse DT for flashes with the rest of the DT parsing Sasha Levin
2026-02-14 0:59 ` [PATCH AUTOSEL 6.19] spi: cadence-qspi: Fix probe error path and remove Sasha Levin
2026-02-14 0:59 ` [PATCH AUTOSEL 6.19-6.12] spi: geni-qcom: Fix abort sequence execution for serial engine errors Sasha Levin
2026-02-14 1:00 ` [PATCH AUTOSEL 6.19-5.10] spi: spi-mem: Protect dirmap_create() with spi_mem_access_start/end Sasha Levin
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=20260214010245.3671907-12-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=broonie@kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=miquel.raynal@bootlin.com \
--cc=patches@lists.linux.dev \
--cc=s-k6@ti.com \
--cc=stable@vger.kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox