[PATCH] scsi: ufs: sprd: disable vdd-mphy on exit
From: Wang Haoran
Date: Thu Nov 19 2026 - 03:16:54 EST
ufs_sprd_n6_init() enables the vdd-mphy regulator but there is no matching
exit callback, so the rail stays on for the whole lifetime of the host and
every unbind, error recovery or host re-probe that runs init again
increments the enable count without ever decrementing it. This is not a
failure-path imbalance but a normal-operation one: the mphy rail is powered
from probe until shutdown and _regulator_put() warns on each release.
Add an exit callback for the n6 host variant that disables the regulator.
Signed-off-by: Wang Haoran <wanghr2026@xxxxxxxxxxxxxxxxxx>
Fixes: df7320bac37e ("scsi: ufs: ufs-unisoc: Add support for Unisoc UFS host controller")
---
diff --git a/drivers/ufs/host/ufs-sprd.c b/drivers/ufs/host/ufs-sprd.c
index 8c0a13e95556..c812eb3e6b11 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,
---
The vulnerability was found by static analysis.