lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2fcf5235-cc94-4202-9164-4889356c5264@sirena.org.uk>
Date: Thu, 4 Dec 2025 17:05:52 +0000
From: Mark Brown <broonie@...nel.org>
To: Nishanth Menon <nm@...com>
Cc: Francesco Dolcini <francesco@...cini.it>,
	Siddharth Vadapalli <s-vadapalli@...com>,
	Anurag Dutta <a-dutta@...com>, linux-spi@...r.kernel.org,
	linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH] spi: cadence-quadspi: Fix clock enable underflows due to
 runtime PM

On Thu, Dec 04, 2025 at 03:11:26PM +0000, Mark Brown wrote:
> On Thu, Dec 04, 2025 at 08:05:30AM -0600, Nishanth Menon wrote:

> > The clock is already turned off by the runtime-PM suspend callback, so an
> > extra clk_disable*_unprepare() is only correct when runtime-PM support is
> > not in use.

> Right, I'm pretty sure that's where the extra disable is coming from.
> The pm_runtime_set_active() further up the function is looking rather
> suspect here.

qspi_setup_flash() is just reading DT data, it's not actually
interacting with the hardware at all, so I think we can sidestep the
immediate issue by just moving it to where we parse the DT for the
controller.  It's not fixing the actual issue with the missing/extra
clock reference but it does get us back to where we were:

diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
index af6d050da1c8..bdbeef05cd72 100644
--- a/drivers/spi/spi-cadence-quadspi.c
+++ b/drivers/spi/spi-cadence-quadspi.c
@@ -1845,6 +1845,12 @@ static int cqspi_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
+	ret = cqspi_setup_flash(cqspi);
+	if (ret) {
+		dev_err(dev, "failed to setup flash parameters %d\n", ret);
+		return ret;
+	}
+
 	/* Obtain QSPI clock. */
 	cqspi->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(cqspi->clk)) {
@@ -1988,12 +1994,6 @@ static int cqspi_probe(struct platform_device *pdev)
 		pm_runtime_get_noresume(dev);
 	}
 
-	ret = cqspi_setup_flash(cqspi);
-	if (ret) {
-		dev_err(dev, "failed to setup flash parameters %d\n", ret);
-		goto probe_setup_failed;
-	}
-
 	host->num_chipselect = cqspi->num_chipselect;
 
 	if (ddata && (ddata->quirks & CQSPI_SUPPORT_DEVICE_RESET))

I'll send this out later assuming nothing blows up in my CI and nobody
else notices an issue.

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ