-/* $OpenBSD: scsiconf.c,v 1.247 2022/03/23 14:36:01 krw Exp $ */
+/* $OpenBSD: scsiconf.c,v 1.248 2022/03/24 00:30:51 krw Exp $ */
/* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */
/*
SC_DEBUG(link, SDEV_DB2, ("dev_probe(link) failed.\n"));
rslt = EINVAL;
}
- free(link, M_DEVBUF, sizeof(*link));
- return rslt;
+ goto free;
}
/*
/* The device doesn't distinguish between LUNs. */
SC_DEBUG(link, SDEV_DB1, ("IDENTIFY not supported.\n"));
rslt = EINVAL;
- goto bad;
+ goto free_devid;
}
link->quirks = devquirks; /* Restore what the device wanted. */
if (cf == NULL) {
scsibussubprint(&sa, sb->sc_dev.dv_xname);
printf(" not configured\n");
- goto bad;
+ goto free_devid;
}
/*
config_attach((struct device *)sb, cf, &sa, scsibussubprint);
return 0;
+free_devid:
+ if (link->id)
+ devid_free(link->id);
bad:
- scsi_detach_link(link, DETACH_FORCE);
+ 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));
return rslt;
}