diff mbox series

scsi: core: Fix "scsi: core: add scsi_host_(block,unblock) helper function"

Message ID 20200717090921.29243-1-yebin10@huawei.com (mailing list archive)
State Mainlined
Commit f30785db7546520acd53aac7497d42352ff031e0
Headers show
Series scsi: core: Fix "scsi: core: add scsi_host_(block,unblock) helper function" | expand

Commit Message

yebin (H) July 17, 2020, 9:09 a.m. UTC
In commit 4dea170f4fb2 ("scsi: core: Fix incorrect usage of shost_for_each_device")
fix usage of shost_for_each_device in function scsi_host_block.

Fix: 2bb955840c1d("scsi: core: add scsi_host_(block,unblock) helper function")
Signed-off-by: Ye Bin <yebin10@huawei.com>
---
 drivers/scsi/scsi_lib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index f3bf2648105c..65fde27b8b08 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2811,8 +2811,10 @@  scsi_host_block(struct Scsi_Host *shost)
 		mutex_lock(&sdev->state_mutex);
 		ret = scsi_internal_device_block_nowait(sdev);
 		mutex_unlock(&sdev->state_mutex);
-		if (ret)
+		if (ret) {
+			scsi_device_put(sdev);
 			break;
+		}
 	}
 
 	/*