diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-03-31 15:34:58 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-03-31 15:34:58 -0500 |
commit | 86579dd06deecfa6ac88d5e84e4d63c397cd6f6d (patch) | |
tree | b4475d3ccde53015ad84a06e4e55e64591171b75 /sound/oss/emu10k1/midi.c | |
parent | 7ea9ea832212c4a755650f7c7cc1ff0b63292a41 (diff) | |
parent | a0f067802576d4eb4c65d40b8ee7d6ea3c81dd61 (diff) |
Merge branch 'master'
Diffstat (limited to 'sound/oss/emu10k1/midi.c')
-rw-r--r-- | sound/oss/emu10k1/midi.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/sound/oss/emu10k1/midi.c b/sound/oss/emu10k1/midi.c index b40b5f97aac..25ae8e4a488 100644 --- a/sound/oss/emu10k1/midi.c +++ b/sound/oss/emu10k1/midi.c @@ -65,7 +65,8 @@ static int midiin_add_buffer(struct emu10k1_mididevice *midi_dev, struct midi_hd init_midi_hdr(midihdr); - if ((midihdr->data = (u8 *) kmalloc(MIDIIN_BUFLEN, GFP_KERNEL)) == NULL) { + midihdr->data = kmalloc(MIDIIN_BUFLEN, GFP_KERNEL); + if (!midihdr->data) { ERROR(); kfree(midihdr); return -1; @@ -110,21 +111,21 @@ match: #endif /* Wait for device to become free */ - down(&card->open_sem); + mutex_lock(&card->open_sem); while (card->open_mode & (file->f_mode << FMODE_MIDI_SHIFT)) { if (file->f_flags & O_NONBLOCK) { - up(&card->open_sem); + mutex_unlock(&card->open_sem); return -EBUSY; } - up(&card->open_sem); + mutex_unlock(&card->open_sem); interruptible_sleep_on(&card->open_wait); if (signal_pending(current)) { return -ERESTARTSYS; } - down(&card->open_sem); + mutex_lock(&card->open_sem); } if ((midi_dev = (struct emu10k1_mididevice *) kmalloc(sizeof(*midi_dev), GFP_KERNEL)) == NULL) @@ -183,7 +184,7 @@ match: card->open_mode |= (file->f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ | FMODE_MIDI_WRITE); - up(&card->open_sem); + mutex_unlock(&card->open_sem); return nonseekable_open(inode, file); } @@ -234,9 +235,9 @@ static int emu10k1_midi_release(struct inode *inode, struct file *file) kfree(midi_dev); - down(&card->open_sem); + mutex_lock(&card->open_sem); card->open_mode &= ~((file->f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ | FMODE_MIDI_WRITE)); - up(&card->open_sem); + mutex_unlock(&card->open_sem); wake_up_interruptible(&card->open_wait); unlock_kernel(); @@ -334,7 +335,8 @@ static ssize_t emu10k1_midi_write(struct file *file, const char __user *buffer, midihdr->bytesrecorded = 0; midihdr->flags = 0; - if ((midihdr->data = (u8 *) kmalloc(count, GFP_KERNEL)) == NULL) { + midihdr->data = kmalloc(count, GFP_KERNEL); + if (!midihdr->data) { ERROR(); kfree(midihdr); return -EINVAL; @@ -545,7 +547,8 @@ int emu10k1_seq_midi_out(int dev, unsigned char midi_byte) midihdr->bytesrecorded = 0; midihdr->flags = 0; - if ((midihdr->data = (u8 *) kmalloc(1, GFP_KERNEL)) == NULL) { + midihdr->data = kmalloc(1, GFP_KERNEL); + if (!midihdr->data) { ERROR(); kfree(midihdr); return -EINVAL; |