Re: [PATCH] scsi: ufs-mediatek: use devm_regulator_get() for the va09 regulator

From: Xiangwu Lai

Date: Tue Nov 17 2026 - 22:20:48 EST


Thank you for the review of:

[PATCH] scsi: ufs-mediatek: use devm_regulator_get() for the va09
regulator
https://lore.kernel.org/r/20261118014234.424-1-laixiangwu@xxxxxxxxxxxxxxxxxxxx

Both findings are confirmed after checking against the source:

- [Medium] unbalanced va09 enable count on devm regulator release:
correct, and it is a regression of v1 -- my mistake. ufs_mtk_init()
powers the M-PHY on (which enables va09), the variant operations
have no .exit callback, and ufshcd_pltfrm_remove() only resumes the
device, so the regulator is still enabled when devm releases it and
_regulator_put() hits WARN_ON(regulator->enable_count).

- [High] state mismatch on regulator failure in
ufs_mtk_mphy_power_on(): also correct, and as you noted this one is
pre-existing (cf137b3ea49a). When regulator_disable() fails in the
power-off path, phy_power_off() has already run, but
host->mphy_powered_on stays set, so the next power-on bails out
through the !(on ^ host->mphy_powered_on) check without powering
the M-PHY back on.

Fixes for both have been sent as a new thread:

[PATCH v2 0/2] scsi: ufs-mediatek: fix va09 regulator lifecycle

1/2 keeps devm_regulator_get() and adds an .exit callback which
powers the M-PHY off (same pattern as ufs-exynos and ufs-qcom), so
the enable count is balanced before the devm release;

2/2 updates host->mphy_powered_on in the power-off path regardless
of the va09 disable result, so the next power-on retries the whole
sequence instead of returning early.

Best regards,
Xiangwu Lai