From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795052235; b=IRKGwbsoJazAItvBU5QQ9ei/Q/rD0I6d6SAPJ8jIxTyhynI+yfg9Uu/LOvQ10XLoCCqX yGmm0Wug/YXM761jE39iSsm348Nl22att3mUDqh1J6gHDJ7rHNGvMVuKUIK5LKJHfvV5T oTo+wEltzd2zw2ZHPr9xvpkw8VCmP7wJjTH+o0znUS+ngjYqwgFM9Rofi1PUbfecXqCuf Ajt7qiavWQY8fXCQSXpjlxaKdfAe+URu08vD3Hel+NDi8ILVvlzR6aZrJAIahxEbpagBF AnTOG4QSkE9I3zNeXCWirYhx8vZXOQZQZFIPfodwxdp4ZFnjCnFVUq1gKqy47AmMb7Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795052235; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=DNwY6/znCTDQWh8HksGqqpwLoC3KSu/AO69lI2zOBvE=; b=ItzyKPHtdIhY7OIhl4uxUvEpAxH02ZGEDu2/odyhGiRvDBQ0ZSrQLjXfKRJAEoDT11jQ 5LCjwu9c4G5pE+pBICs0Gbj2alma3nrzzNSIYaUDDQge5S0hqInD/LXKQIWUoPxgZ3gwm omIMmX5q2NUcx90bmoKdvEPt/jPZ7UMygHP5acp4ZjCLfJWFSA209gBRwk+dE7bvNxgMv NtJkrfKWqeZr7XvSC0gCORr5ry9+BMRJgp0bPVgew9mu6wg3WkJ8XXNDAZPuz9RvRWuMG FJYM9zJRgK6dsri5Fo64Pd2ytX2E/lomuEKKgVLvs7ISUrzRv4hkACzoTlC0m8BgHqw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=rNJXM6Xm; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8500E606A325; Thu, 19 Nov 2026 01:37:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=rNJXM6Xm Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7E2E1F000C4; Thu, 19 Nov 2026 01:37:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795052235; bh=DNwY6/znCTDQWh8HksGqqpwLoC3KSu/AO69lI2zOBvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rNJXM6Xm6gDDyShc5fxPYI6YrYy4pYO1HGr845n99c1bUU0TzGVxV982UTIvFovCE julSzEPqzeyXtGdBNSUqpw28I/5dcFBFpc24vgGJZAkHIAfQ/RlQXDGWwbIiHvUNRC sFVAUweUITXHOizNagvjr11Ptaxt84Ek8aDyanEM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Damien Le Moal , Niklas Cassel , Sasha Levin Subject: [PATCH 5.15 0491/2214] ata: ahci_st: Assert the power down reset in the probe() error path Date: Wed, 18 Nov 2026 15:36:07 +0100 Message-ID: <20261118150030.830169085@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150009.797899913@linuxfoundation.org> References: <20261118150009.797899913@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Niklas Cassel [ Upstream commit 91e0a7452d7a81e924a499b23f30f3bf85fddbd2 ] st_ahci_probe_resets() deasserts the "pwr-dwn" reset, but the probe() error path of st_ahci_probe() only releases the host resources, so the SATA IP is left powered up when probe() fails after st_ahci_probe_resets() has succeeded, e.g. when ahci_platform_enable_resources() fails. The reset is asserted by st_ahci_host_stop(), however ->host_stop() is only called through the ata_host_stop() devres action registered by ata_host_start(), so it does not cover any failure happening before the host has been started. Factor the assert out into st_ahci_assert_pwrdwn() and call it when either ahci_platform_enable_resources() or ahci_platform_init_host() fails. The "pwr-dwn" reset control is an exclusive one, so asserting it once more from st_ahci_host_stop() is harmless. No functional change intended for ->host_stop() and st_ahci_suspend(). Fixes: 76884cb2f7da ("ahci: st: Add support for ST's SATA IP") Cc: stable@vger.kernel.org Reviewed-by: Damien Le Moal Link: https://lore.kernel.org/r/20260915084127.692494-10-cassel@kernel.org Signed-off-by: Niklas Cassel Signed-off-by: Sasha Levin --- drivers/ata/ahci_st.c | 51 +++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/drivers/ata/ahci_st.c b/drivers/ata/ahci_st.c index 98ec746d4a2ca..e5ee7adba07a2 100644 --- a/drivers/ata/ahci_st.c +++ b/drivers/ata/ahci_st.c @@ -84,18 +84,27 @@ static int st_ahci_deassert_resets(struct ahci_host_priv *hpriv, return 0; } -static void st_ahci_host_stop(struct ata_host *host) +static int st_ahci_assert_pwrdwn(struct ahci_host_priv *hpriv, + struct device *dev) { - struct ahci_host_priv *hpriv = host->private_data; struct st_ahci_drv_data *drv_data = hpriv->plat_data; - struct device *dev = host->dev; int err; - if (drv_data->pwr) { - err = reset_control_assert(drv_data->pwr); - if (err) - dev_err(dev, "unable to pwrdwn\n"); - } + if (!drv_data->pwr) + return 0; + + err = reset_control_assert(drv_data->pwr); + if (err) + dev_err(dev, "unable to pwrdwn\n"); + + return err; +} + +static void st_ahci_host_stop(struct ata_host *host) +{ + struct ahci_host_priv *hpriv = host->private_data; + + st_ahci_assert_pwrdwn(hpriv, host->dev); ahci_platform_disable_resources(hpriv); } @@ -161,7 +170,7 @@ static int st_ahci_probe(struct platform_device *pdev) err = ahci_platform_enable_resources(hpriv); if (err) - return err; + goto assert_pwrdwn; st_ahci_configure_oob(hpriv->mmio); @@ -170,12 +179,17 @@ static int st_ahci_probe(struct platform_device *pdev) err = ahci_platform_init_host(pdev, hpriv, &st_ahci_port_info, &ahci_platform_sht); - if (err) { - ahci_platform_disable_resources(hpriv); - return err; - } + if (err) + goto disable_resources; return 0; + +disable_resources: + ahci_platform_disable_resources(hpriv); +assert_pwrdwn: + st_ahci_assert_pwrdwn(hpriv, &pdev->dev); + + return err; } #ifdef CONFIG_PM_SLEEP @@ -183,20 +197,15 @@ static int st_ahci_suspend(struct device *dev) { struct ata_host *host = dev_get_drvdata(dev); struct ahci_host_priv *hpriv = host->private_data; - struct st_ahci_drv_data *drv_data = hpriv->plat_data; int err; err = ahci_platform_suspend_host(dev); if (err) return err; - if (drv_data->pwr) { - err = reset_control_assert(drv_data->pwr); - if (err) { - dev_err(dev, "unable to pwrdwn"); - return err; - } - } + err = st_ahci_assert_pwrdwn(hpriv, dev); + if (err) + return err; ahci_platform_disable_resources(hpriv); -- 2.53.0