[PATCH] scsi: ufs: Remove redundant vops NULL check and trivial wrapper

Chanwoo Lee posted 1 patch 1 week, 3 days ago
drivers/ufs/core/ufshcd.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
[PATCH] scsi: ufs: Remove redundant vops NULL check and trivial wrapper
Posted by Chanwoo Lee 1 week, 3 days ago
ufshcd_variant_hba_init/exit() check 'if (!hba->vops)' before
calling vops wrappers, but the wrappers already do NULL check
internally. Remove the redundant checks. Also remove
ufshcd_variant_hba_exit() entirely since it only wraps
ufshcd_vops_exit() with no added value.

Signed-off-by: Chanwoo Lee <cw9316.lee@samsung.com>
---
 drivers/ufs/core/ufshcd.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 7481c71c71b8..1f914d095adb 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -9870,28 +9870,15 @@ static int ufshcd_init_clocks(struct ufs_hba *hba)
 
 static int ufshcd_variant_hba_init(struct ufs_hba *hba)
 {
-	int err = 0;
-
-	if (!hba->vops)
-		goto out;
+	int err = ufshcd_vops_init(hba);
 
-	err = ufshcd_vops_init(hba);
 	if (err)
 		dev_err_probe(hba->dev, err,
 			      "%s: variant %s init failed with err %d\n",
 			      __func__, ufshcd_get_var_name(hba), err);
-out:
 	return err;
 }
 
-static void ufshcd_variant_hba_exit(struct ufs_hba *hba)
-{
-	if (!hba->vops)
-		return;
-
-	ufshcd_vops_exit(hba);
-}
-
 static int ufshcd_hba_init(struct ufs_hba *hba)
 {
 	int err;
@@ -9959,7 +9946,7 @@ static void ufshcd_hba_exit(struct ufs_hba *hba)
 		if (hba->eh_wq)
 			destroy_workqueue(hba->eh_wq);
 		ufs_debugfs_hba_exit(hba);
-		ufshcd_variant_hba_exit(hba);
+		ufshcd_vops_exit(hba);
 		ufshcd_setup_vreg(hba, false);
 		ufshcd_setup_clocks(hba, false);
 		ufshcd_setup_hba_vreg(hba, false);
-- 
2.43.0
Re: [PATCH] scsi: ufs: Remove redundant vops NULL check and trivial wrapper
Posted by Martin K. Petersen 6 days, 10 hours ago
Chanwoo,

> ufshcd_variant_hba_init/exit() check 'if (!hba->vops)' before
> calling vops wrappers, but the wrappers already do NULL check
> internally. Remove the redundant checks. Also remove
> ufshcd_variant_hba_exit() entirely since it only wraps
> ufshcd_vops_exit() with no added value.

Applied to 7.2/scsi-staging, thanks!

-- 
Martin K. Petersen
Re: [PATCH] scsi: ufs: Remove redundant vops NULL check and trivial wrapper
Posted by Bart Van Assche 1 week, 2 days ago
On 5/28/26 11:16 PM, Chanwoo Lee wrote:
> ufshcd_variant_hba_init/exit() check 'if (!hba->vops)' before
> calling vops wrappers, but the wrappers already do NULL check
> internally. Remove the redundant checks. Also remove
> ufshcd_variant_hba_exit() entirely since it only wraps
> ufshcd_vops_exit() with no added value.

For future patches, please stick to the "one change per patch" rule.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Re: [PATCH] scsi: ufs: Remove redundant vops NULL check and trivial wrapper
Posted by Peter Wang (王信友) 1 week, 3 days ago
On Fri, 2026-05-29 at 15:16 +0900, Chanwoo Lee wrote:
> ufshcd_variant_hba_init/exit() check 'if (!hba->vops)' before
> calling vops wrappers, but the wrappers already do NULL check
> internally. Remove the redundant checks. Also remove
> ufshcd_variant_hba_exit() entirely since it only wraps
> ufshcd_vops_exit() with no added value.
> 
> Signed-off-by: Chanwoo Lee <cw9316.lee@samsung.com>
> ---

Reviewed-by: Peter Wang <peter.wang@mediatek.com>