diff options
author | stas <stas@FreeBSD.org> | 2009-04-20 12:43:07 +0000 |
---|---|---|
committer | stas <stas@FreeBSD.org> | 2009-04-20 12:43:07 +0000 |
commit | a780a09a2b78068eb257ee0108e556be3c191053 (patch) | |
tree | 511943b2df3c7852655afcbafab5a1bfde01a5ab /sys/dev/sound/pci | |
parent | 588e47016ee655cb8f7f0b9b5afdd9e005275b16 (diff) | |
download | FreeBSD-src-a780a09a2b78068eb257ee0108e556be3c191053.zip FreeBSD-src-a780a09a2b78068eb257ee0108e556be3c191053.tar.gz |
- Properly unlock mutex on failure in channel_trigger. Before this
the function just returned with the mutex held.
MFC after: 1 week
Diffstat (limited to 'sys/dev/sound/pci')
-rw-r--r-- | sys/dev/sound/pci/envy24.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/sys/dev/sound/pci/envy24.c b/sys/dev/sound/pci/envy24.c index 0fd57d8..fc6fc8a 100644 --- a/sys/dev/sound/pci/envy24.c +++ b/sys/dev/sound/pci/envy24.c @@ -1766,6 +1766,7 @@ envy24chan_trigger(kobj_t obj, void *data, int go) struct sc_info *sc = ch->parent; u_int32_t ptr; int slot; + int error = 0; #if 0 int i; @@ -1787,8 +1788,10 @@ envy24chan_trigger(kobj_t obj, void *data, int go) sc->caps[0].minspeed = sc->caps[0].maxspeed = sc->speed; sc->caps[1].minspeed = sc->caps[1].maxspeed = sc->speed; } - else if (ch->speed != 0 && ch->speed != sc->speed) - return -1; + else if (ch->speed != 0 && ch->speed != sc->speed) { + error = -1; + goto fail; + } if (ch->speed == 0) ch->channel->speed = sc->speed; /* start or enable channel */ @@ -1818,16 +1821,20 @@ envy24chan_trigger(kobj_t obj, void *data, int go) #if(0) device_printf(sc->dev, "envy24chan_trigger(): emldmawr\n"); #endif - if (ch->run != 1) - return -1; + if (ch->run != 1) { + error = -1; + goto fail; + } ch->emldma(ch); break; case PCMTRIG_EMLDMARD: #if(0) device_printf(sc->dev, "envy24chan_trigger(): emldmard\n"); #endif - if (ch->run != 1) - return -1; + if (ch->run != 1) { + error = -1; + goto fail; + } ch->emldma(ch); break; case PCMTRIG_ABORT: @@ -1859,9 +1866,9 @@ envy24chan_trigger(kobj_t obj, void *data, int go) } break; } +fail: snd_mtxunlock(sc->lock); - - return 0; + return (error); } static int |