Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162633438
D54131.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D54131.diff
View Options
diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c
--- a/sys/dev/sound/midi/midi.c
+++ b/sys/dev/sound/midi/midi.c
@@ -109,7 +109,8 @@
{
struct snd_midi *m;
int inqsize, outqsize;
- uint8_t *buf;
+ uint8_t *ibuf = NULL;
+ uint8_t *obuf = NULL;
m = malloc(sizeof(*m), M_MIDI, M_WAITOK | M_ZERO);
kobj_init((kobj_t)m, cls);
@@ -121,26 +122,17 @@
mtx_init(&m->lock, "raw midi", NULL, 0);
- mtx_lock(&m->lock);
-
if (inqsize)
- buf = malloc(sizeof(uint8_t) * inqsize, M_MIDI, M_NOWAIT);
- else
- buf = NULL;
+ ibuf = malloc(inqsize, M_MIDI, M_WAITOK);
+ if (outqsize)
+ obuf = malloc(outqsize, M_MIDI, M_WAITOK);
- MIDIQ_INIT(m->inq, buf, inqsize);
+ mtx_lock(&m->lock);
- if (outqsize)
- buf = malloc(sizeof(uint8_t) * outqsize, M_MIDI, M_NOWAIT);
- else
- buf = NULL;
m->hiwat = outqsize / 2;
- MIDIQ_INIT(m->outq, buf, outqsize);
-
- if ((inqsize && !MIDIQ_BUF(m->inq)) ||
- (outqsize && !MIDIQ_BUF(m->outq)))
- goto err2;
+ MIDIQ_INIT(m->inq, ibuf, inqsize);
+ MIDIQ_INIT(m->outq, obuf, outqsize);
m->flags = 0;
m->unit = alloc_unr(dev_unr);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 16, 6:58 AM (3 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35127799
Default Alt Text
D54131.diff (1 KB)
Attached To
Mode
D54131: sound: Improve snd_midi->{in,out}q allocation
Attached
Detach File
Event Timeline
Log In to Comment