diff options
author | Matthew Dempsky <matthew@cvs.openbsd.org> | 2010-07-22 05:21:03 +0000 |
---|---|---|
committer | Matthew Dempsky <matthew@cvs.openbsd.org> | 2010-07-22 05:21:03 +0000 |
commit | 4d7a94bb0235877da1bc92992153cf245928e28b (patch) | |
tree | 1fbc4410d930aea8e1ba6774230d96e459a9981d /sys/scsi | |
parent | 157bebc453506b252856362372b7ef370be59b21 (diff) |
style(9) fix and release rwlock(9) if scsi_xs_get() returns NULL,
which should never happen anyway. Fixes scsi_scsi_cmd() removal
regression.
ok dlg@
Diffstat (limited to 'sys/scsi')
-rw-r--r-- | sys/scsi/safte.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/scsi/safte.c b/sys/scsi/safte.c index 14c17c03436..dca4f2d9734 100644 --- a/sys/scsi/safte.c +++ b/sys/scsi/safte.c @@ -1,4 +1,4 @@ -/* $OpenBSD: safte.c,v 1.42 2010/07/22 04:59:31 matthew Exp $ */ +/* $OpenBSD: safte.c,v 1.43 2010/07/22 05:21:02 matthew Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -397,7 +397,7 @@ void safte_read_encstat(void *arg) { struct safte_readbuf_cmd *cmd; - struct safte_sensor*s; + struct safte_sensor *s; struct safte_softc *sc = (struct safte_softc *)arg; struct scsi_xfer *xs; int error, i, flags = 0; @@ -408,8 +408,10 @@ safte_read_encstat(void *arg) if (cold) flags |= SCSI_AUTOCONF; xs = scsi_xs_get(sc->sc_link, flags | SCSI_DATA_IN | SCSI_SILENT); - if (xs == NULL) + if (xs == NULL) { + rw_exit_write(&sc->sc_lock); return; + } xs->cmd->opcode = READ_BUFFER; xs->cmdlen = sizeof(*cmd); xs->data = sc->sc_encbuf; |