summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2022-03-23 14:36:02 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2022-03-23 14:36:02 +0000
commit6e0cd0cef178976936c0a6eae182bb249e7f16b1 (patch)
tree31508a74a7413f41564ee778727ccdbeea5bb5d3 /sys
parent2dd5ed6141d7d6290d3ded2d7ed7fff38c9da73a (diff)
When configuring a scsi_link that has passed dev_probe() but
fallen at one of the subsequent hurdles of scsi_probe_link() don't partially replicate scsi_discard_link(). Just call scsi_discard_link(). It now handles such partially configured scsi_link's.
Diffstat (limited to 'sys')
-rw-r--r--sys/scsi/scsiconf.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c
index 941fdd6661f..7847ce73417 100644
--- a/sys/scsi/scsiconf.c
+++ b/sys/scsi/scsiconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.c,v 1.246 2022/03/22 16:29:58 krw Exp $ */
+/* $OpenBSD: scsiconf.c,v 1.247 2022/03/23 14:36:01 krw Exp $ */
/* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */
/*
@@ -519,7 +519,8 @@ scsi_probe_link(struct scsibus_softc *sb, int target, int lun, int dumbscan)
SC_DEBUG(link, SDEV_DB2, ("dev_probe(link) failed.\n"));
rslt = EINVAL;
}
- goto free;
+ free(link, M_DEVBUF, sizeof(*link));
+ return rslt;
}
/*
@@ -622,7 +623,7 @@ scsi_probe_link(struct scsibus_softc *sb, int target, int lun, int dumbscan)
/* The device doesn't distinguish between LUNs. */
SC_DEBUG(link, SDEV_DB1, ("IDENTIFY not supported.\n"));
rslt = EINVAL;
- goto free_devid;
+ goto bad;
}
link->quirks = devquirks; /* Restore what the device wanted. */
@@ -679,7 +680,7 @@ scsi_probe_link(struct scsibus_softc *sb, int target, int lun, int dumbscan)
if (cf == NULL) {
scsibussubprint(&sa, sb->sc_dev.dv_xname);
printf(" not configured\n");
- goto free_devid;
+ goto bad;
}
/*
@@ -717,17 +718,8 @@ scsi_probe_link(struct scsibus_softc *sb, int target, int lun, int dumbscan)
config_attach((struct device *)sb, cf, &sa, scsibussubprint);
return 0;
-free_devid:
- if (link->id)
- devid_free(link->id);
bad:
- if (ISSET(link->flags, SDEV_OWN_IOPL))
- free(link->pool, M_DEVBUF, sizeof(*link->pool));
-
- if (sb->sb_adapter->dev_free != NULL)
- sb->sb_adapter->dev_free(link);
-free:
- free(link, M_DEVBUF, sizeof(*link));
+ scsi_detach_link(link, DETACH_FORCE);
return rslt;
}