diff mbox series

scsi: ufs: remove unnecessary pointer judgement

Message ID 20190330090313.26291-1-zengguangyue@hisilicon.com
State New
Headers show
Series scsi: ufs: remove unnecessary pointer judgement | expand

Commit Message

Zeng Guangyue March 30, 2019, 9:03 a.m. UTC
The pointer value is initialized as &hba->vreg_info, and it's never
changed. It's not necessary to check the pointer is null or not.

Signed-off-by: Zeng Guangyue <zengguangyue@hisilicon.com>

---
 drivers/scsi/ufs/ufshcd.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

-- 
2.20.1.309.g16a465bc01

Comments

Winkler, Tomas March 30, 2019, 10:42 a.m. UTC | #1
> 

> The pointer value is initialized as &hba->vreg_info, and it's never changed. It's

> not necessary to check the pointer is null or not.

> 

> Signed-off-by: Zeng Guangyue <zengguangyue@hisilicon.com>

Looks like you are correct.
Ack.

Thanks
Tomas

> ---

>  drivers/scsi/ufs/ufshcd.c | 11 +----------

>  1 file changed, 1 insertion(+), 10 deletions(-)

> 

> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index

> e040f9dd9ff3..f4a8931443b0 100644

> --- a/drivers/scsi/ufs/ufshcd.c

> +++ b/drivers/scsi/ufs/ufshcd.c

> @@ -7103,9 +7103,6 @@ static int ufshcd_setup_vreg(struct ufs_hba *hba,

> bool on)

>  	struct device *dev = hba->dev;

>  	struct ufs_vreg_info *info = &hba->vreg_info;

> 

> -	if (!info)

> -		goto out;

> -

>  	ret = ufshcd_toggle_vreg(dev, info->vcc, on);

>  	if (ret)

>  		goto out;

> @@ -7131,10 +7128,7 @@ static int ufshcd_setup_hba_vreg(struct ufs_hba

> *hba, bool on)  {

>  	struct ufs_vreg_info *info = &hba->vreg_info;

> 

> -	if (info)

> -		return ufshcd_toggle_vreg(hba->dev, info->vdd_hba, on);

> -

> -	return 0;

> +	return ufshcd_toggle_vreg(hba->dev, info->vdd_hba, on);

>  }

> 

>  static int ufshcd_get_vreg(struct device *dev, struct ufs_vreg *vreg) @@ -

> 7160,9 +7154,6 @@ static int ufshcd_init_vreg(struct ufs_hba *hba)

>  	struct device *dev = hba->dev;

>  	struct ufs_vreg_info *info = &hba->vreg_info;

> 

> -	if (!info)

> -		goto out;

> -

>  	ret = ufshcd_get_vreg(dev, info->vcc);

>  	if (ret)

>  		goto out;

> --

> 2.20.1.309.g16a465bc01
Martin K. Petersen April 4, 2019, 3:18 a.m. UTC | #2
Zeng,

> The pointer value is initialized as &hba->vreg_info, and it's never

> changed. It's not necessary to check the pointer is null or not.


Applied to 5.2/scsi-queue, thanks.

-- 
Martin K. Petersen	Oracle Linux Engineering
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index e040f9dd9ff3..f4a8931443b0 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -7103,9 +7103,6 @@  static int ufshcd_setup_vreg(struct ufs_hba *hba, bool on)
 	struct device *dev = hba->dev;
 	struct ufs_vreg_info *info = &hba->vreg_info;
 
-	if (!info)
-		goto out;
-
 	ret = ufshcd_toggle_vreg(dev, info->vcc, on);
 	if (ret)
 		goto out;
@@ -7131,10 +7128,7 @@  static int ufshcd_setup_hba_vreg(struct ufs_hba *hba, bool on)
 {
 	struct ufs_vreg_info *info = &hba->vreg_info;
 
-	if (info)
-		return ufshcd_toggle_vreg(hba->dev, info->vdd_hba, on);
-
-	return 0;
+	return ufshcd_toggle_vreg(hba->dev, info->vdd_hba, on);
 }
 
 static int ufshcd_get_vreg(struct device *dev, struct ufs_vreg *vreg)
@@ -7160,9 +7154,6 @@  static int ufshcd_init_vreg(struct ufs_hba *hba)
 	struct device *dev = hba->dev;
 	struct ufs_vreg_info *info = &hba->vreg_info;
 
-	if (!info)
-		goto out;
-
 	ret = ufshcd_get_vreg(dev, info->vcc);
 	if (ret)
 		goto out;