From nobody Fri Oct 2 13:14:00 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9AFE413D62; Fri, 31 Jul 2026 10:54:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785495285; cv=none; b=gqC4VIM63A4PwC6nycBumlugssyH3Muem4YFqaQkqfUVRVckowit1ixnpYSniU3RLU608Fqbo24ZQGCw7+eKjS/CAkzFYR2LaSNotvSP8P54ZWV35pftRypxUkKoMs6VtBaRp+Os1FPNVdprazOBkl9a3KZb9Rhn5togemqBJn4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785495285; c=relaxed/simple; bh=A+RYlvea3muHJkR3NxXPPCl5DxXF4LYmaoormXO+aiI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nmRayhS4DqTgobeHfXj/5XW+QH3hUSW8yDeGf1krw6S9tb6gsBlwwoDv6YDBZHAVPCWsUgMLi4NVX6RhkLeouSXR6J9a+BuWcjT6Y/MclhS6t29PAgdn1mUJsTYkNeP3VVdUK0lQj9zwwgRMFyAh+7BbgLbYw2qPyrfxWWLXH3c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=yq+wPqUm; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="yq+wPqUm" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id D685B4E4104B; Fri, 31 Jul 2026 10:54:32 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id AC3AF6039A; Fri, 31 Jul 2026 10:54:32 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C70EA11C166F4; Fri, 31 Jul 2026 12:54:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785495268; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=45YoHV0abmLlyEJ5V4MZxscl5HAFA4m1pFJTxKtyNYI=; b=yq+wPqUm7JqJ7Oyp04a4li73hxVfdzyPkrRn54X4nirKrNtcA2DFmIHbaorH5OcPqoA7NI Dgo3I4K9++MIVzcKhO7gtGtCQjBGIMlt08j1YiREXNJcfOBBOizhGWCgzCjW7zKPVStIj2 zalXP6rF1vtiInMWpsbxXW3P7uyIY4BCMXjqndfNMCd1tXiICwcWydxXOvZtiCvDhOrh7P bsX8OdRynOSWMk906JluEvjBnhOm/lT6GwDpkFcWT6LODZ12oXU2OPUCBrSlfYrGyArKae KI7gkJ7ftjAQAPXDDAUZOzGWbaUAlbI2Tb0ejZYQ2SlINGvaqkTMb+DNLcOnjw== From: "Diogo Ivo (Schneider Electric)" Date: Fri, 31 Jul 2026 12:53:46 +0200 Subject: [PATCH 1/2] spi: cadence-quadspi: fix runtime pm cleanup on probe failure/unbind Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260731-cqspi-pm_runtime-v1-1-ff0bfc9e8e56@bootlin.com> References: <20260731-cqspi-pm_runtime-v1-0-ff0bfc9e8e56@bootlin.com> In-Reply-To: <20260731-cqspi-pm_runtime-v1-0-ff0bfc9e8e56@bootlin.com> To: Mark Brown , Matthew Gerlach , Khairul Anuar Romli , Greg Kroah-Hartman , Dan Carpenter Cc: miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, Pascal EBERHARD , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, "Diogo Ivo (Schneider Electric)" , stable@vger.kernel.org X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2452; i=diogo.ivo@bootlin.com; h=from:subject:message-id; bh=A+RYlvea3muHJkR3NxXPPCl5DxXF4LYmaoormXO+aiI=; b=owEBbQKS/ZANAwAKAQa+fFtWXslFAcsmYgBqbH7bAOEBCctkWgWD1JTAVWQ/bfNfEb8sCMLOT 3Iz3QZNUmuJAjMEAAEKAB0WIQTma35o1i1081e8B2UGvnxbVl7JRQUCamx+2wAKCRAGvnxbVl7J Re+hD/9wmKNLbQL7lUIoyWv5sJel7kR6Qu2vRmfSWsL3jk3Q17HBAShLevsuZJczTA+hWI6TST8 4KkiB7uZSwPF3X7ZI889a76HC14KJ6o+MFc3Gx4OKZyMtmVeaoHB5jKZW5BNIY87wVVp56X/RIF BT90I0PoSn2s2P/Rnr/w1nhbQ9JhkjCRGHaHiVazPOFiUxvGtulSmhX/fP9bxkzUA1+TO/6zqor bmsm/euIO4ki50X0uCmm0f97/YJSUkutlSuytzG5x8Mp8vCKil75qQtF1hKSSWjVUYnV3+Boe8z 7HN/jx8Ed1Das0BD1Cuy0uZoMOVDCXkxzqEzuo6pNQ0gIDznhcENknI7+Dx1CUQxsiKumDL1aNK cJuug9VFx7e+G0vpCJzOVh7tRIh2MOmTxcDW/wY6LNY6kG9Jm9d5kq1PIQnmFc6qI6o08NJTAl0 4jUJeJa3q2DERPZL5bCiuNlBwMaUhMyNYvPIDuLWxa46znIWJO2lLuSR4dsYC3jQvlASv9AT08V nYzy+/cd2SHYBHG1ChEkpxClLU/GhPkg6dB7W8+JLtz8qIoVUSkT9xQn7xPnfv20J7DSPxMFRJR Y6sG2wZvJNgbb+kH5xxSyt9d8aiN3qeVJmgbSbow/ttHLeRSWcdlYBmErpUuCCv/U0OoOAMPgQa Kbkt27Wv4Pdle3w== X-Developer-Key: i=diogo.ivo@bootlin.com; a=openpgp; fpr=E66B7E68D62D74F357BC076506BE7C5B565EC945 X-Last-TLS-Session-Version: TLSv1.3 Currently the probe cleanup path is imbalanced regarding pm_runtime_enable() and pm_runtime_disable(). For example, if the probe defers after calling cqspi_request_mmap_dma() pm_runtime_disable() will be called without a prior call to pm_runtime_enable(), causing an imbalance. Furthermore, the cleanup path does not undo all the runtime calls made while probing. Fix this by enforcing the correct correspondence between pm_runtime_enable() and pm_runtime_resume() and add the missing PM cleanup calls. As the history of this driver in mainline is convoluted with several rounds of fixes it includes the fixes from two commits, namely commit 5ff4d5d1af0c ("spi: cadence-quadspi: fix runtime pm disable imbalance on probe failure") and commit 5e8bb0cc72f1 ("spi: cadence-quadspi: fix runtime pm and clock imbalance on unbind"). Fixes: 74b0b4cf13fc ("spi: spi-cadence-quadspi: Fix pm runtime unbalance") Cc: stable@vger.kernel.org Signed-off-by: Diogo Ivo (Schneider Electric) --- drivers/spi/spi-cadence-quadspi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-qu= adspi.c index da8401261bbc..d749dee54015 100644 --- a/drivers/spi/spi-cadence-quadspi.c +++ b/drivers/spi/spi-cadence-quadspi.c @@ -1862,7 +1862,6 @@ static int cqspi_probe(struct platform_device *pdev) if (ret) return ret; =20 - ret =3D clk_prepare_enable(cqspi->clk); if (ret) { dev_err(dev, "Cannot enable QSPI clock.\n"); @@ -1983,16 +1982,19 @@ static int cqspi_probe(struct platform_device *pdev) ret =3D spi_register_controller(host); if (ret) { dev_err(&pdev->dev, "failed to register SPI ctlr %d\n", ret); - goto probe_setup_failed; + goto disable_rpm; } =20 pm_runtime_mark_last_busy(dev); pm_runtime_put_autosuspend(dev); =20 return 0; +disable_rpm: + pm_runtime_put_noidle(dev); + pm_runtime_dont_use_autosuspend(dev); + pm_runtime_disable(dev); probe_setup_failed: cqspi_controller_enable(cqspi, 0); - pm_runtime_disable(dev); probe_reset_failed: if (cqspi->is_jh7110) cqspi_jh7110_disable_clk(pdev, cqspi); @@ -2026,6 +2028,7 @@ static void cqspi_remove(struct platform_device *pdev) cqspi_jh7110_disable_clk(pdev, cqspi); =20 pm_runtime_put_sync(&pdev->dev); + pm_runtime_dont_use_autosuspend(&pdev->dev); pm_runtime_disable(&pdev->dev); } =20 --=20 2.55.0 From nobody Fri Oct 2 13:14:00 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D69B3E4506; Fri, 31 Jul 2026 10:54:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785495288; cv=none; b=madZ3Z4fXh8S89mo49B9nFLf+jOWBOSE9/Jy391jzdnQBPPH2o2lxNHBIzazIn7BH+gD4sJYMhfd9p+xmDit4V1ovwUS695IG27MM0TVFp3AihMDpx1/MsQHpOyfOIbcIe2Wzx2cJei6VVNb7aBCzJ0OvuumvK7QD67CYsi5Dio= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785495288; c=relaxed/simple; bh=Ov5O6+IUmIoxKUd7aa3NlEk6KfvP352nl59N378600A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pja9JvgltFdhuouPy/VaUoFtikVBHS7XPXxMlcFJds16DPRRqrOCYju93rujSpLnBloVilEmY/+4PQE04S8CLCHsp9OFbz1bnAWZvvaPS4FcqHu3i9h9f06ozdVNzNdlHz4FbH/nJP2+P+ri9qd0CthONuLMId+wSJv6E2Z6CR4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=h6+at44Q; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="h6+at44Q" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 281BB4E4104D; Fri, 31 Jul 2026 10:54:38 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id F18D86039A; Fri, 31 Jul 2026 10:54:37 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 538EF11C166EE; Fri, 31 Jul 2026 12:54:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1785495273; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=amECKdhGa2WRnIHdDlpYZ0s3e5gaENTiWLRcewHI7Vc=; b=h6+at44Q/iXoGCqTHY77KYmzpxaV6jBOD9rcBE4Sb8uxuLKqBCl5qB2aGXGpgMoIGIbo1Y kzOL4CmrTpUWTYC50pAKrRx3nYFlv0wJLKM/S1ADGHVNKYE93OTxFnSCyA39yk8nwqR9C7 cN2In1s2nFNEbdA4V4TP1gbN6CRx2wsn7Qg5xQwUREDVcn3M3Ic2lsEzrJDrBFHryxUYX9 8S764pF+Kc+r2lyGQ4946GNdCm68W/skcsg+I3qkUTR9Kr+dVLFu+mwwJai3hiGY7aQgQk z1C7IBT/brUcDNTW13qBrWKejGmDMDRE4aTOVG4llqdTA4zY/KEs6wQqacjuyw== From: "Diogo Ivo (Schneider Electric)" Date: Fri, 31 Jul 2026 12:53:47 +0200 Subject: [PATCH 2/2] spi: cadence-quadspi: release DMA channel on probe failure Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260731-cqspi-pm_runtime-v1-2-ff0bfc9e8e56@bootlin.com> References: <20260731-cqspi-pm_runtime-v1-0-ff0bfc9e8e56@bootlin.com> In-Reply-To: <20260731-cqspi-pm_runtime-v1-0-ff0bfc9e8e56@bootlin.com> To: Mark Brown , Matthew Gerlach , Khairul Anuar Romli , Greg Kroah-Hartman , Dan Carpenter Cc: miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, Pascal EBERHARD , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, "Diogo Ivo (Schneider Electric)" , stable@vger.kernel.org X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1424; i=diogo.ivo@bootlin.com; h=from:subject:message-id; bh=Ov5O6+IUmIoxKUd7aa3NlEk6KfvP352nl59N378600A=; b=owEBbQKS/ZANAwAKAQa+fFtWXslFAcsmYgBqbH7cxhUAbjsWz9JT2i+8tHDrYgSoWpWb9FLTV fzqulYm/fyJAjMEAAEKAB0WIQTma35o1i1081e8B2UGvnxbVl7JRQUCamx+3AAKCRAGvnxbVl7J RUx1D/oCUC7SSU/kWiRiALg2CmA5lJsLfguUEoDYNbUAxUJ5WWJUTeYMQccF49kQTDhRSunYqDH RucdtMuF8+DxueVFfU6h6gVZLwCl2N24BkX4/t1orAEudqK1HvR3h+Dn8t96tfovikac6TCGxr8 /kW5xkeL/0XR4TT1S5YGVGWiU4HJiUHPWpncoTdudFpKo1a2j67x8IC9wf8Qdzhf24zjOxx+11J e66UXozWEd7uDMmhSb+RIXAP/8VLUJ8ewjZtIF3F17PmapaVkGrgQZyemF8j8bSD9L7wiRqAMIO ZG+A+owd4QATuHzyoLQEYlpYTYUPcrBNCuHT6sG+Cq6cL0Y28VpX16740W0JaHV33m1my1r9tdT nVmfXq7YUHo/UCS96ZzSoJ3M+2/PuCr6BbAd0/gFWzzYzk4xXcc/QDW5x54XmxpTEzNV5cy3BpF AO1Dqghykzb8F15gjldQIRHVwLRgBKPJz/WwcO+cL7PPE2yc1w/ISL8310JVBcDXzkoZLJDcciU XLwzREayrt1sQR5S1Q1AZQeFYYr5LlTEhyOeqtDx6rszXZYYSEP6Zcu2om9p+km/jPKu2sX1H3y qoGgZ/G1kbkInz1ci1PVQh8B/gdmd2bozOf7vNS8hNkpmpp0ZX5EbQouWF+1skW69emikYR5RFK VyjVA/2rrr3v7Gg== X-Developer-Key: i=diogo.ivo@bootlin.com; a=openpgp; fpr=E66B7E68D62D74F357BC076506BE7C5B565EC945 X-Last-TLS-Session-Version: TLSv1.3 When spi_register_controller() fails in cqspi_probe(), the DMA channel acquired via cqspi_request_mmap_dma() is not released, leaking the channel. Add a dedicated error label to release the DMA channel before the existing runtime PM teardown path. This fix is one part of upstream commit f18c8cfa4f1a ("spi: cadence-qspi: Fix probe error path and remove"). Fixes: b85815675fc5 ("spi: cadence-quadspi: fix cleanup of rx_chan on failu= re paths") Cc: stable@vger.kernel.org Signed-off-by: Diogo Ivo (Schneider Electric) --- 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-qu= adspi.c index d749dee54015..66304664a1cf 100644 --- a/drivers/spi/spi-cadence-quadspi.c +++ b/drivers/spi/spi-cadence-quadspi.c @@ -1982,14 +1982,17 @@ static int cqspi_probe(struct platform_device *pdev) ret =3D spi_register_controller(host); if (ret) { dev_err(&pdev->dev, "failed to register SPI ctlr %d\n", ret); - goto disable_rpm; + goto release_dma_chan; } =20 pm_runtime_mark_last_busy(dev); pm_runtime_put_autosuspend(dev); =20 return 0; -disable_rpm: +release_dma_chan: + if (cqspi->rx_chan) + dma_release_channel(cqspi->rx_chan); + pm_runtime_put_noidle(dev); pm_runtime_dont_use_autosuspend(dev); pm_runtime_disable(dev); --=20 2.55.0