[v3,2/2] scsi: ufs: remove several redundant goto statements
diff mbox series

Message ID 20200814095034.20709-3-huobean@gmail.com
State Accepted
Commit e62212672ab527dfa87d59c8bd3da6a7969e89dd
Headers show
Series
  • make UFS dev_cmd more readable
Related show

Commit Message

Bean Huo Aug. 14, 2020, 9:50 a.m. UTC
From: Bean Huo <beanhuo@micron.com>

Signed-off-by: Bean Huo <beanhuo@micron.com>
---
 drivers/scsi/ufs/ufshcd.c | 25 +++++--------------------
 1 file changed, 5 insertions(+), 20 deletions(-)

Comments

Asutosh Das (asd) Aug. 14, 2020, 4:54 p.m. UTC | #1
On Fri, Aug 14 2020 at 02:50 -0700, Bean Huo wrote:
>From: Bean Huo <beanhuo@micron.com>
>
>Signed-off-by: Bean Huo <beanhuo@micron.com>

Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>

>---
> drivers/scsi/ufs/ufshcd.c | 25 +++++--------------------
> 1 file changed, 5 insertions(+), 20 deletions(-)
>
>diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
>index e3663b85e8ee..79b216c012d3 100644
>--- a/drivers/scsi/ufs/ufshcd.c
>+++ b/drivers/scsi/ufs/ufshcd.c
>@@ -4256,10 +4256,8 @@ int ufshcd_make_hba_operational(struct ufs_hba *hba)
> 		dev_err(hba->dev,
> 			"Host controller not ready to process requests");
> 		err = -EIO;
>-		goto out;
> 	}
>
>-out:
> 	return err;
> }
> EXPORT_SYMBOL_GPL(ufshcd_make_hba_operational);
>@@ -5542,10 +5540,8 @@ static bool ufshcd_quirk_dl_nac_errors(struct ufs_hba *hba)
> 			hba->saved_err &= ~UIC_ERROR;
> 		/* clear NAC error */
> 		hba->saved_uic_err &= ~UFSHCD_UIC_DL_NAC_RECEIVED_ERROR;
>-		if (!hba->saved_uic_err) {
>+		if (!hba->saved_uic_err)
> 			err_handling = false;
>-			goto out;
>-		}
> 	}
> out:
> 	spin_unlock_irqrestore(hba->host->host_lock, flags);
>@@ -7604,12 +7600,10 @@ static int ufshcd_config_vreg(struct device *dev,
> 		if (vreg->min_uV && vreg->max_uV) {
> 			min_uV = on ? vreg->min_uV : 0;
> 			ret = regulator_set_voltage(reg, min_uV, vreg->max_uV);
>-			if (ret) {
>+			if (ret)
> 				dev_err(dev,
> 					"%s: %s set voltage failed, err=%d\n",
> 					__func__, name, ret);
>-				goto out;
>-			}
> 		}
> 	}
> out:
>@@ -7672,8 +7666,6 @@ static int ufshcd_setup_vreg(struct ufs_hba *hba, bool on)
> 		goto out;
>
> 	ret = ufshcd_toggle_vreg(dev, info->vccq2, on);
>-	if (ret)
>-		goto out;
>
> out:
> 	if (ret) {
>@@ -7719,10 +7711,8 @@ static int ufshcd_init_vreg(struct ufs_hba *hba)
> 		goto out;
>
> 	ret = ufshcd_get_vreg(dev, info->vccq);
>-	if (ret)
>-		goto out;
>-
>-	ret = ufshcd_get_vreg(dev, info->vccq2);
>+	if (!ret)
>+		ret = ufshcd_get_vreg(dev, info->vccq2);
> out:
> 	return ret;
> }
>@@ -7866,12 +7856,7 @@ static int ufshcd_variant_hba_init(struct ufs_hba *hba)
>
> 	err = ufshcd_vops_setup_regulators(hba, true);
> 	if (err)
>-		goto out_exit;
>-
>-	goto out;
>-
>-out_exit:
>-	ufshcd_vops_exit(hba);
>+		ufshcd_vops_exit(hba);
> out:
> 	if (err)
> 		dev_err(hba->dev, "%s: variant %s init failed err %d\n",
>-- 
>2.17.1
>
Stanley Chu Aug. 16, 2020, 1:01 a.m. UTC | #2
On Fri, 2020-08-14 at 11:50 +0200, Bean Huo wrote:
> From: Bean Huo <beanhuo@micron.com>
> 
> Signed-off-by: Bean Huo <beanhuo@micron.com>

Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>

Patch
diff mbox series

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index e3663b85e8ee..79b216c012d3 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4256,10 +4256,8 @@  int ufshcd_make_hba_operational(struct ufs_hba *hba)
 		dev_err(hba->dev,
 			"Host controller not ready to process requests");
 		err = -EIO;
-		goto out;
 	}
 
-out:
 	return err;
 }
 EXPORT_SYMBOL_GPL(ufshcd_make_hba_operational);
@@ -5542,10 +5540,8 @@  static bool ufshcd_quirk_dl_nac_errors(struct ufs_hba *hba)
 			hba->saved_err &= ~UIC_ERROR;
 		/* clear NAC error */
 		hba->saved_uic_err &= ~UFSHCD_UIC_DL_NAC_RECEIVED_ERROR;
-		if (!hba->saved_uic_err) {
+		if (!hba->saved_uic_err)
 			err_handling = false;
-			goto out;
-		}
 	}
 out:
 	spin_unlock_irqrestore(hba->host->host_lock, flags);
@@ -7604,12 +7600,10 @@  static int ufshcd_config_vreg(struct device *dev,
 		if (vreg->min_uV && vreg->max_uV) {
 			min_uV = on ? vreg->min_uV : 0;
 			ret = regulator_set_voltage(reg, min_uV, vreg->max_uV);
-			if (ret) {
+			if (ret)
 				dev_err(dev,
 					"%s: %s set voltage failed, err=%d\n",
 					__func__, name, ret);
-				goto out;
-			}
 		}
 	}
 out:
@@ -7672,8 +7666,6 @@  static int ufshcd_setup_vreg(struct ufs_hba *hba, bool on)
 		goto out;
 
 	ret = ufshcd_toggle_vreg(dev, info->vccq2, on);
-	if (ret)
-		goto out;
 
 out:
 	if (ret) {
@@ -7719,10 +7711,8 @@  static int ufshcd_init_vreg(struct ufs_hba *hba)
 		goto out;
 
 	ret = ufshcd_get_vreg(dev, info->vccq);
-	if (ret)
-		goto out;
-
-	ret = ufshcd_get_vreg(dev, info->vccq2);
+	if (!ret)
+		ret = ufshcd_get_vreg(dev, info->vccq2);
 out:
 	return ret;
 }
@@ -7866,12 +7856,7 @@  static int ufshcd_variant_hba_init(struct ufs_hba *hba)
 
 	err = ufshcd_vops_setup_regulators(hba, true);
 	if (err)
-		goto out_exit;
-
-	goto out;
-
-out_exit:
-	ufshcd_vops_exit(hba);
+		ufshcd_vops_exit(hba);
 out:
 	if (err)
 		dev_err(hba->dev, "%s: variant %s init failed err %d\n",