summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2022-02-27 02:27:56 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2022-02-27 02:27:56 +0000
commitb868150c75e7821c9a0e73a0e67d869263e50b02 (patch)
tree4cae57165315a85cc236e442853848171c42d064 /sys/scsi
parent8eeea038b64fd69216520982e51f8c3823243df2 (diff)
SC_DEBUG() requires an initialized scsi_link. Shuffle
code to make it so. Pointed out by clang when prodded with SCSIDEBUG.
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/sd.c10
-rw-r--r--sys/scsi/st.c6
2 files changed, 8 insertions, 8 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index bb19ee0cd92..7e5570fb9b2 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.330 2021/10/24 16:57:30 mpi Exp $ */
+/* $OpenBSD: sd.c,v 1.331 2022/02/27 02:27:55 krw Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -315,10 +315,6 @@ sdopen(dev_t dev, int flag, int fmt, struct proc *p)
unit = DISKUNIT(dev);
part = DISKPART(dev);
- SC_DEBUG(link, SDEV_DB1,
- ("sdopen: dev=0x%x (unit %d (of %d), partition %d)\n", dev, unit,
- sd_cd.cd_ndevs, part));
-
rawopen = (part == RAW_PART) && (fmt == S_IFCHR);
sc = sdlookup(unit);
@@ -330,6 +326,10 @@ sdopen(dev_t dev, int flag, int fmt, struct proc *p)
}
link = sc->sc_link;
+ SC_DEBUG(link, SDEV_DB1,
+ ("sdopen: dev=0x%x (unit %d (of %d), partition %d)\n", dev, unit,
+ sd_cd.cd_ndevs, part));
+
if (ISSET(flag, FWRITE) && ISSET(link->flags, SDEV_READONLY)) {
device_unref(&sc->sc_dev);
return EACCES;
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index 7cee3848fa9..34ee76916f6 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: st.c,v 1.188 2022/01/11 23:10:11 jsg Exp $ */
+/* $OpenBSD: st.c,v 1.189 2022/02/27 02:27:55 krw Exp $ */
/* $NetBSD: st.c,v 1.71 1997/02/21 23:03:49 thorpej Exp $ */
/*
@@ -360,8 +360,8 @@ stopen(dev_t dev, int flags, int fmt, struct proc *p)
if (st == NULL)
return ENXIO;
if (ISSET(st->flags, ST_DYING)) {
- error = ENXIO;
- goto done;
+ device_unref(&st->sc_dev);
+ return ENXIO;
}
link = st->sc_link;