diff mbox series

[v3,5/8] scsi: ufs: Use 'else' in ufshcd_set_dev_pwr_mode()

Message ID 20220929220021.247097-6-bvanassche@acm.org
State Superseded
Headers show
Series Fix a deadlock in the UFS driver | expand

Commit Message

Bart Van Assche Sept. 29, 2022, 10 p.m. UTC
Convert if (ret) { ... } if (!ret) { ... } into
if (ret) { ... } else { ... }.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/ufs/core/ufshcd.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Bean Huo Sept. 30, 2022, 10:28 a.m. UTC | #1
On Thu, 2022-09-29 at 15:00 -0700, Bart Van Assche wrote:
> Convert if (ret) { ... } if (!ret) { ... } into
> if (ret) { ... } else { ... }.
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Reviewed-by: Bean Huo <beanhuo@micron.com>
Adrian Hunter Oct. 3, 2022, 5:58 a.m. UTC | #2
On 30/09/22 01:00, Bart Van Assche wrote:
> Convert if (ret) { ... } if (!ret) { ... } into
> if (ret) { ... } else { ... }.
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/ufs/core/ufshcd.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 78c980585dc3..02e73208b921 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -8798,10 +8798,9 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
>  				scsi_print_sense_hdr(sdp, NULL, &sshdr);
>  			ret = -EIO;
>  		}
> -	}
> -
> -	if (!ret)
> +	} else {
>  		hba->curr_dev_pwr_mode = pwr_mode;
> +	}
>  
>  	scsi_device_put(sdp);
>  	hba->host->eh_noresume = 0;
diff mbox series

Patch

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 78c980585dc3..02e73208b921 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -8798,10 +8798,9 @@  static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
 				scsi_print_sense_hdr(sdp, NULL, &sshdr);
 			ret = -EIO;
 		}
-	}
-
-	if (!ret)
+	} else {
 		hba->curr_dev_pwr_mode = pwr_mode;
+	}
 
 	scsi_device_put(sdp);
 	hba->host->eh_noresume = 0;