diff options
-rw-r--r-- | usr.bin/sndiod/dev.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/usr.bin/sndiod/dev.c b/usr.bin/sndiod/dev.c index 801e36231be..49888085fda 100644 --- a/usr.bin/sndiod/dev.c +++ b/usr.bin/sndiod/dev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev.c,v 1.30 2017/11/07 11:41:07 ratchov Exp $ */ +/* $OpenBSD: dev.c,v 1.31 2017/11/23 06:26:45 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org> * @@ -1514,19 +1514,19 @@ slot_new(struct dev *d, char *who, struct slotops *ops, void *arg, int mode) found: if (!dev_ref(d)) return NULL; - s->dev = d; - s->ops = ops; - s->arg = arg; - s->pstate = SLOT_INIT; - s->tstate = MMC_OFF; - - if ((mode & s->dev->mode) != mode) { + if ((mode & d->mode) != mode) { if (log_level >= 1) { slot_log(s); log_puts(": requested mode not supported\n"); } + dev_unref(d); return 0; } + s->dev = d; + s->ops = ops; + s->arg = arg; + s->pstate = SLOT_INIT; + s->tstate = MMC_OFF; s->mode = mode; aparams_init(&s->par); if (s->mode & MODE_PLAY) { |