From: Anurag Dutta <a-dutta@ti.com>
To: <broonie@kernel.org>
Cc: <grmoore@opensource.altera.com>, <nm@ti.com>,
<francesco@dolcini.it>, <s-vadapalli@ti.com>,
<linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<gehariprasath@ti.com>, <u-kumar1@ti.com>, <a-dutta@ti.com>
Subject: [PATCH 2/2] spi: cadence-quadspi: Fix clock disable on probe failure path
Date: Fri, 12 Dec 2025 12:53:12 +0530 [thread overview]
Message-ID: <20251212072312.2711806-3-a-dutta@ti.com> (raw)
In-Reply-To: <20251212072312.2711806-1-a-dutta@ti.com>
When cqspi_request_mmap_dma() returns -EPROBE_DEFER after runtime PM
is enabled, the error path calls clk_disable_unprepare() on an already
disabled clock, causing an imbalance.
Use pm_runtime_get_sync() to increment the usage counter and resume the
device. This prevents runtime_suspend() from being invoked and causing
a double clock disable.
Fixes: 140623410536 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller")
Signed-off-by: Anurag Dutta <a-dutta@ti.com>
---
drivers/spi/spi-cadence-quadspi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
index 7c1f742d95a6..f8823e83a622 100644
--- a/drivers/spi/spi-cadence-quadspi.c
+++ b/drivers/spi/spi-cadence-quadspi.c
@@ -2026,7 +2026,9 @@ static int cqspi_probe(struct platform_device *pdev)
probe_reset_failed:
if (cqspi->is_jh7110)
cqspi_jh7110_disable_clk(pdev, cqspi);
- clk_disable_unprepare(cqspi->clk);
+
+ if (pm_runtime_get_sync(&pdev->dev) >= 0)
+ clk_disable_unprepare(cqspi->clk);
probe_clk_failed:
return ret;
}
--
2.34.1
next prev parent reply other threads:[~2025-12-12 7:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-12 7:23 [PATCH 0/2] spi: cadence-quadspi: Fix probe error path and logging Anurag Dutta
2025-12-12 7:23 ` [PATCH 1/2] spi: cadence-quadspi: Add error logging for DMA request failure Anurag Dutta
2025-12-12 7:23 ` Anurag Dutta [this message]
2025-12-12 8:44 ` [PATCH 2/2] spi: cadence-quadspi: Fix clock disable on probe failure path Mark Brown
2025-12-15 18:13 ` Nishanth Menon
2025-12-18 9:32 ` [PATCH 0/2] spi: cadence-quadspi: Fix probe error path and logging Mark Brown
2025-12-23 17:06 ` Mark Brown
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=20251212072312.2711806-3-a-dutta@ti.com \
--to=a-dutta@ti.com \
--cc=broonie@kernel.org \
--cc=francesco@dolcini.it \
--cc=gehariprasath@ti.com \
--cc=grmoore@opensource.altera.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=nm@ti.com \
--cc=s-vadapalli@ti.com \
--cc=u-kumar1@ti.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