summaryrefslogtreecommitdiff
path: root/sys/scsi/scsiconf.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2022-03-21 00:20:41 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2022-03-21 00:20:41 +0000
commitb53307de1292d43c7abcf50bfd36945b5c66a0ac (patch)
tree9f249edb2cb660acde592ed5582d930244e9be0a /sys/scsi/scsiconf.c
parent1a3fead4a648ef52829934ccf86370864cc24b0c (diff)
No point in calling scsi_link_shutdown() if link->pool is NULL.
Ditto config_detach() if link->device_softc is NULL. Currently just some extra paranoia, but will allow simplification of exit logic in scsi_probe_link() and other future uses of scsi_detach_link() on partially configured links. No intentional functional change.
Diffstat (limited to 'sys/scsi/scsiconf.c')
-rw-r--r--sys/scsi/scsiconf.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c
index 22742df798f..eab5af66073 100644
--- a/sys/scsi/scsiconf.c
+++ b/sys/scsi/scsiconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.c,v 1.243 2022/03/03 19:10:13 krw Exp $ */
+/* $OpenBSD: scsiconf.c,v 1.244 2022/03/21 00:20:40 krw Exp $ */
/* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */
/*
@@ -807,13 +807,15 @@ scsi_detach_link(struct scsi_link *link, int flags)
/* Detaching a device from scsibus is a five step process. */
/* 1. Wake up processes sleeping for an xs. */
- scsi_link_shutdown(link);
+ if (link->pool != NULL)
+ scsi_link_shutdown(link);
/* 2. Detach the device. */
- rv = config_detach(link->device_softc, flags);
-
- if (rv != 0)
- return rv;
+ if (link->device_softc != NULL) {
+ rv = config_detach(link->device_softc, flags);
+ if (rv != 0)
+ return rv;
+ }
/* 3. If it's using the openings io allocator, clean that up. */
if (ISSET(link->flags, SDEV_OWN_IOPL)) {