[PATCH v11 06/24] scsi: ufs: mediatek: Rework resets
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Tue Sep 1 08:58:22 PDT 2026
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] A spurious warning 'PHY reset failed: (null)' is logged during host reset when the optional MPHY is absent.
--
commit 37450d6f129323aed779a5a4a77bdb0dba397435
Author: Nicolas Frattaroli <nicolas.frattaroli at collabora.com>
scsi: ufs: mediatek: Rework resets
This commit reworks the UFS Mediatek driver to use bulk reset APIs.
It also removes legacy MPHY reset components and transitions to optional
reset variants.
> diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
> --- a/drivers/ufs/host/ufs-mediatek.c
> +++ b/drivers/ufs/host/ufs-mediatek.c
[ ... ]
> @@ -204,49 +210,46 @@ static void ufs_mtk_crypto_enable(struct ufs_hba *hba)
> static void ufs_mtk_host_reset(struct ufs_hba *hba)
> {
> struct ufs_mtk_host *host = ufshcd_get_variant(hba);
[ ... ]
> + ret = phy_reset(host->mphy);
>
> - /* restore mphy setting aftre mphy reset */
> - if (host->mphy_reset)
> - ufs_mtk_mphy_ctrl(UFS_MPHY_RESTORE, res);
> -}
> + /*
> + * Only sleep if there is no MPHY or MPHY doesn't have a reset
> + * implemented (which already sleeps) or the PHY reset function failed
> + * somehow, just to be safe
> + */
> + if (!host->mphy || ret) {
> + usleep_range(100, 110);
> + if (ret != -EOPNOTSUPP)
> + dev_warn(hba->dev, "PHY reset failed: %pe\n", ERR_PTR(ret));
[Severity: Low]
Does this code inadvertently log a spurious warning when the optional MPHY is
absent?
In ufs_mtk_host_reset(), when host->mphy is NULL, phy_reset(NULL) returns 0.
The condition if (!host->mphy || ret) evaluates to true, and since 0 is not
equal to -EOPNOTSUPP, this path seems to incorrectly trigger the dev_warn() on
every reset. This will result in a confusing error message like
'PHY reset failed: (null)'.
> }
> +
> + ret = reset_control_bulk_deassert(MTK_UFS_NUM_RESETS, host->resets);
> + if (ret)
> + dev_warn(hba->dev, "Host reset deassert failed: %pe\n", ERR_PTR(ret));
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260901-mt8196-ufs-v11-0-dbd007704490@collabora.com?part=6
More information about the linux-phy
mailing list