Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144791837
D45982.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D45982.diff
View Options
diff --git a/sys/dev/sound/pci/hdsp-pcm.c b/sys/dev/sound/pci/hdsp-pcm.c
--- a/sys/dev/sound/pci/hdsp-pcm.c
+++ b/sys/dev/sound/pci/hdsp-pcm.c
@@ -661,6 +661,35 @@
}
/* Channel interface. */
+static int
+hdspchan_free(kobj_t obj, void *data)
+{
+ struct sc_pcminfo *scp;
+ struct sc_chinfo *ch;
+ struct sc_info *sc;
+
+ ch = data;
+ scp = ch->parent;
+ sc = scp->sc;
+
+#if 0
+ device_printf(scp->dev, "hdspchan_free()\n");
+#endif
+
+ snd_mtxlock(sc->lock);
+ if (ch->data != NULL) {
+ free(ch->data, M_HDSP);
+ ch->data = NULL;
+ }
+ if (ch->caps != NULL) {
+ free(ch->caps, M_HDSP);
+ ch->caps = NULL;
+ }
+ snd_mtxunlock(sc->lock);
+
+ return (0);
+}
+
static void *
hdspchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b,
struct pcm_channel *c, int dir)
@@ -720,6 +749,7 @@
if (sndbuf_setup(ch->buffer, ch->data, ch->size) != 0) {
device_printf(scp->dev, "Can't setup sndbuf.\n");
+ hdspchan_free(obj, ch);
return (NULL);
}
@@ -793,35 +823,6 @@
return (pos);
}
-static int
-hdspchan_free(kobj_t obj, void *data)
-{
- struct sc_pcminfo *scp;
- struct sc_chinfo *ch;
- struct sc_info *sc;
-
- ch = data;
- scp = ch->parent;
- sc = scp->sc;
-
-#if 0
- device_printf(scp->dev, "hdspchan_free()\n");
-#endif
-
- snd_mtxlock(sc->lock);
- if (ch->data != NULL) {
- free(ch->data, M_HDSP);
- ch->data = NULL;
- }
- if (ch->caps != NULL) {
- free(ch->caps, M_HDSP);
- ch->caps = NULL;
- }
- snd_mtxunlock(sc->lock);
-
- return (0);
-}
-
static int
hdspchan_setformat(kobj_t obj, void *data, uint32_t format)
{
diff --git a/sys/dev/sound/pci/hdspe-pcm.c b/sys/dev/sound/pci/hdspe-pcm.c
--- a/sys/dev/sound/pci/hdspe-pcm.c
+++ b/sys/dev/sound/pci/hdspe-pcm.c
@@ -650,6 +650,35 @@
}
/* Channel interface. */
+static int
+hdspechan_free(kobj_t obj, void *data)
+{
+ struct sc_pcminfo *scp;
+ struct sc_chinfo *ch;
+ struct sc_info *sc;
+
+ ch = data;
+ scp = ch->parent;
+ sc = scp->sc;
+
+#if 0
+ device_printf(scp->dev, "hdspechan_free()\n");
+#endif
+
+ snd_mtxlock(sc->lock);
+ if (ch->data != NULL) {
+ free(ch->data, M_HDSPE);
+ ch->data = NULL;
+ }
+ if (ch->caps != NULL) {
+ free(ch->caps, M_HDSPE);
+ ch->caps = NULL;
+ }
+ snd_mtxunlock(sc->lock);
+
+ return (0);
+}
+
static void *
hdspechan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b,
struct pcm_channel *c, int dir)
@@ -702,6 +731,7 @@
if (sndbuf_setup(ch->buffer, ch->data, ch->size) != 0) {
device_printf(scp->dev, "Can't setup sndbuf.\n");
+ hdspechan_free(obj, ch);
return (NULL);
}
@@ -774,35 +804,6 @@
return (pos);
}
-static int
-hdspechan_free(kobj_t obj, void *data)
-{
- struct sc_pcminfo *scp;
- struct sc_chinfo *ch;
- struct sc_info *sc;
-
- ch = data;
- scp = ch->parent;
- sc = scp->sc;
-
-#if 0
- device_printf(scp->dev, "hdspechan_free()\n");
-#endif
-
- snd_mtxlock(sc->lock);
- if (ch->data != NULL) {
- free(ch->data, M_HDSPE);
- ch->data = NULL;
- }
- if (ch->caps != NULL) {
- free(ch->caps, M_HDSPE);
- ch->caps = NULL;
- }
- snd_mtxunlock(sc->lock);
-
- return (0);
-}
-
static int
hdspechan_setformat(kobj_t obj, void *data, uint32_t format)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 13, 3:54 PM (18 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28678127
Default Alt Text
D45982.diff (3 KB)
Attached To
Mode
D45982: snd_hdsp*: Free up channel resources in case of CHANNEL_INIT() failure
Attached
Detach File
Event Timeline
Log In to Comment