-/* $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 $ */
/*-
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);
}
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;
-/* $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 $ */
/*
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;