Re: [PATCH v7 18/23] scsi: ufs: mediatek: Don't acquire dvfsrc-vcore twice

From: AngeloGioacchino Del Regno

Date: Wed Feb 25 2026 - 07:39:39 EST


Il 25/02/26 11:34, Peter Wang (王信友) ha scritto:
On Mon, 2026-02-16 at 14:37 +0100, Nicolas Frattaroli wrote:
@@ -519,15 +519,13 @@ static void ufs_mtk_boost_crypt(struct ufs_hba
*hba, bool boost)
 {
  struct ufs_mtk_host *host = ufshcd_get_variant(hba);
  struct ufs_mtk_crypt_cfg *cfg;
- struct regulator *reg;
  int volt, ret;
- if (!ufs_mtk_is_boost_crypt_enabled(hba))
+ if (!ufs_mtk_is_boost_crypt_enabled(hba) || !host-
reg_vcore)
  return;

If host->reg_vcore is NULL,
should ufs_mtk_is_boost_crypt_enabled be false?
So we don’t need to check both, right?

We need to check both because UFS_MTK_CAP_BOOST_CRYPT_ENGINE depends on:
1. reg_vcore
2. clocks (crypt_mux, crypt_lp, crypt_perf).

Failing to check for both ufs_mtk_is_boost_crypt_enabled() and reg_vcore here
will introduce a bug that may result in storage corruption.

So yes, Nicolas is checking both because it is *required* to check both.

Regards,
Angelo