Skip to content

Commit

Permalink
scsi: ufs: Simplify ufshcd_set_dev_pwr_mode()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Avri Altman <[email protected]>
Signed-off-by: Bart Van Assche <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
bvanassche authored and martinkpetersen committed Oct 18, 2022
1 parent d460f62 commit 6d1aa3b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions drivers/ufs/core/ufshcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6d1aa3b

Please sign in to comment.