From: krw Date: Mon, 21 Mar 2022 00:20:40 +0000 (+0000) Subject: No point in calling scsi_link_shutdown() if link->pool is NULL. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=22d8fe70649cb743196d9b60e48a177d1c9e462b;p=openbsd 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. --- 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)) {