summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2022-10-14 17:24:16 -0700
committerMartin K. Petersen <martin.petersen@oracle.com>2022-10-18 03:17:09 +0000
commit6d1aa3b0589bdd17a46ed74fbd2c2d0fc59038ff (patch)
treeb2cb77d0bbbe5501a7d91571e37f26a5a29a1d3a /drivers
parentd460f624059266c2e7f0280bdd3ae806d4b75211 (diff)
downloadlinux-6d1aa3b0589bdd17a46ed74fbd2c2d0fc59038ff.tar.bz2
scsi: ufs: Simplify ufshcd_set_dev_pwr_mode()
Simplify the code for incrementing the SCSI device reference count in ufshcd_set_dev_pwr_mode(). This commit removes one scsi_device_put() call that happens from atomic context. Reviewed-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Avri Altman <avri.altman@wdc.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20221015002418.30955-7-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ufs/core/ufshcd.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 7256e6c43ca6..c8f0fe740005 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -8752,15 +8752,10 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
spin_lock_irqsave(hba->host->host_lock, flags);
sdp = hba->ufs_device_wlun;
- if (sdp) {
+ if (sdp && scsi_device_online(sdp))
ret = scsi_device_get(sdp);
- if (!ret && !scsi_device_online(sdp)) {
- ret = -ENODEV;
- scsi_device_put(sdp);
- }
- } else {
+ else
ret = -ENODEV;
- }
spin_unlock_irqrestore(hba->host->host_lock, flags);
if (ret)