linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Pengpeng Hou <pengpeng@iscas.ac.cn>
To: "James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Pengpeng Hou <pengpeng@iscas.ac.cn>,
	"Martin K . Petersen" <mkp@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	linux-scsi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ufs: rockchip: propagate controller reset errors
Date: Sun, 30 Aug 2026 21:27:23 +0800	[thread overview]
Message-ID: <20260830132723.5855-1-pengpeng@iscas.ac.cn> (raw)

The Rockchip UFS reset helper discards reset-controller errors before
probe, HCE enable, and runtime resume continue as if the controller were
reset.

Return reset errors from the helper and unwind the resume clock on failure.

Fixes: d3cbe455d6eb ("scsi: ufs: rockchip: Initial support for UFS")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/ufs/host/ufs-rockchip.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/ufs/host/ufs-rockchip.c b/drivers/ufs/host/ufs-rockchip.c
index bac68f238e1c4..3b9661befe6ae 100644
--- a/drivers/ufs/host/ufs-rockchip.c
+++ b/drivers/ufs/host/ufs-rockchip.c
@@ -20,11 +20,16 @@
 #include "ufshcd-pltfrm.h"
 #include "ufs-rockchip.h"
 
-static void ufs_rockchip_controller_reset(struct ufs_rockchip_host *host)
+static int ufs_rockchip_controller_reset(struct ufs_rockchip_host *host)
 {
-	reset_control_assert(host->rst);
+	int ret;
+
+	ret = reset_control_assert(host->rst);
+	if (ret)
+		return ret;
 	udelay(1);
-	reset_control_deassert(host->rst);
+
+	return reset_control_deassert(host->rst);
 }
 
 static int ufs_rockchip_hce_enable_notify(struct ufs_hba *hba,
@@ -46,9 +51,7 @@ static int ufs_rockchip_hce_enable_notify(struct ufs_hba *hba,
 	}
 
 	/* PRE_CHANGE */
-	ufs_rockchip_controller_reset(host);
-
-	return 0;
+	return ufs_rockchip_controller_reset(host);
 }
 
 static void ufs_rockchip_set_pm_lvl(struct ufs_hba *hba)
@@ -167,7 +170,9 @@ static int ufs_rockchip_common_init(struct ufs_hba *hba)
 		return dev_err_probe(dev, PTR_ERR(host->rst),
 				"failed to get reset control\n");
 
-	ufs_rockchip_controller_reset(host);
+	err = ufs_rockchip_controller_reset(host);
+	if (err)
+		return dev_err_probe(dev, err, "failed to reset controller\n");
 
 	host->ref_out_clk = devm_clk_get_enabled(dev, "ref_out");
 	if (IS_ERR(host->ref_out_clk))
@@ -291,7 +296,11 @@ static int ufs_rockchip_runtime_resume(struct device *dev)
 		return err;
 	}
 
-	ufs_rockchip_controller_reset(host);
+	err = ufs_rockchip_controller_reset(host);
+	if (err) {
+		clk_disable_unprepare(host->ref_out_clk);
+		return err;
+	}
 
 	return ufshcd_runtime_resume(dev);
 }

base-commit: 08dbfad3f5040f5bdb6c529da20d6d4e81fefd72
-- 
2.50.1



                 reply	other threads:[~2026-08-30 13:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260830132723.5855-1-pengpeng@iscas.ac.cn \
    --to=pengpeng@iscas.ac.cn \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=heiko@sntech.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mkp@kernel.org \
    --cc=p.zabel@pengutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).