summaryrefslogtreecommitdiff
path: root/drivers/target/loopback
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2026-06-15 21:01:30 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2026-06-15 21:01:30 -0400
commit4f87e9068bf3aaf45f226261d5efd50bec42c12c (patch)
tree64ed81ea2559bb799f0905be4cbdbd37bb247fbf /drivers/target/loopback
parent7c08d430835a90414cd962e3a9602e5b002dee3b (diff)
parent5d5221f8a4064a256b9499485a9f8c6f530f21dc (diff)
Merge branch 7.1/scsi-fixes into 7.2/scsi-staging
Pull in outstanding commits from 7.1 branch. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/target/loopback')
-rw-r--r--drivers/target/loopback/tcm_loop.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index f8902087c6c9..d29830b951f7 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -329,6 +329,7 @@ static int tcm_loop_driver_probe(struct device *dev)
if (error) {
pr_err("%s: scsi_add_host failed\n", __func__);
scsi_host_put(sh);
+ tl_hba->sh = NULL;
return -ENODEV;
}
return 0;
@@ -342,8 +343,10 @@ static void tcm_loop_driver_remove(struct device *dev)
tl_hba = to_tcm_loop_hba(dev);
sh = tl_hba->sh;
- scsi_remove_host(sh);
- scsi_host_put(sh);
+ if (sh) {
+ scsi_remove_host(sh);
+ scsi_host_put(sh);
+ }
}
static void tcm_loop_release_adapter(struct device *dev)
@@ -372,6 +375,11 @@ static int tcm_loop_setup_hba_bus(struct tcm_loop_hba *tl_hba, int tcm_loop_host
return -ENODEV;
}
+ if (!tl_hba->sh) {
+ device_unregister(&tl_hba->dev);
+ return -ENODEV;
+ }
+
return 0;
}