[PATCH] scsi: ufs: ufs-sprd: Fix vdd-mphy regulator leak on probe failure and remove
From: Xiangwu Lai
Date: Tue Nov 10 2026 - 01:55:20 EST
ufs_sprd_n6_init() enables the vdd-mphy regulator, but nothing ever
disables it again: the driver has no .exit callback and no other path
calls regulator_disable(), so the power rail stays enabled after a
failed probe as well as after driver removal.
The UFS core calls the vops .exit callback from ufshcd_hba_exit(),
which runs on probe failure and on remove, so an .exit hook is the
natural place to release the supply. All other vendor drivers in
drivers/ufs/host/ already provide one.
Fixes: df7320bac37e ("scsi: ufs: ufs-unisoc: Add support for Unisoc UFS host controller")
Signed-off-by: laixiangwu <laixiangwu@xxxxxxxxxxxxxxxxxxxx>
---
drivers/ufs/host/ufs-sprd.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/ufs/host/ufs-sprd.c b/drivers/ufs/host/ufs-sprd.c
index 6862250c5..30acbfe6c 100644
--- a/drivers/ufs/host/ufs-sprd.c
+++ b/drivers/ufs/host/ufs-sprd.c
@@ -266,6 +266,13 @@ static int ufs_sprd_n6_init(struct ufs_hba *hba)
return 0;
}
+static void ufs_sprd_n6_exit(struct ufs_hba *hba)
+{
+ struct ufs_sprd_priv *priv = ufs_sprd_get_priv_data(hba);
+
+ regulator_disable(priv->vregi[SPRD_UFS_VDD_MPHY].vreg);
+}
+
static int ufs_sprd_n6_phy_init(struct ufs_hba *hba)
{
int ret = 0;
@@ -394,6 +401,7 @@ static struct ufs_sprd_priv n6_ufs = {
.ufs_hba_sprd_vops = {
.name = "sprd,ums9620-ufs",
.init = ufs_sprd_n6_init,
+ .exit = ufs_sprd_n6_exit,
.hce_enable_notify = sprd_ufs_n6_hce_enable_notify,
.pwr_change_notify = sprd_ufs_pwr_change_notify,
.hibern8_notify = sprd_ufs_n6_h8_notify,