fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / sound / oss / emu10k1 / audio.c
index cde4d59..efcf589 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/bitops.h>
 #include <asm/io.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/smp_lock.h>
 
 #include "hwaccess.h"
@@ -110,9 +111,15 @@ static ssize_t emu10k1_audio_read(struct file *file, char __user *buffer, size_t
 
                if ((bytestocopy >= wiinst->buffer.fragment_size)
                    || (bytestocopy >= count)) {
+                       int rc;
+
                        bytestocopy = min_t(u32, bytestocopy, count);
 
-                       emu10k1_wavein_xferdata(wiinst, (u8 __user *)buffer, &bytestocopy);
+                       rc = emu10k1_wavein_xferdata(wiinst,
+                                                    (u8 __user *)buffer,
+                                                    &bytestocopy);
+                       if (rc)
+                               return rc;
 
                        count -= bytestocopy;
                        buffer += bytestocopy;
@@ -1132,7 +1139,7 @@ static int emu10k1_audio_open(struct inode *inode, struct file *file)
 
 match:
 
-       wave_dev = (struct emu10k1_wavedevice *) kmalloc(sizeof(struct emu10k1_wavedevice), GFP_KERNEL);
+       wave_dev = kmalloc(sizeof(struct emu10k1_wavedevice), GFP_KERNEL);
 
        if (wave_dev == NULL) { 
                ERROR();
@@ -1148,7 +1155,7 @@ match:
                /* Recording */
                struct wiinst *wiinst;
 
-               if ((wiinst = (struct wiinst *) kmalloc(sizeof(struct wiinst), GFP_KERNEL)) == NULL) {
+               if ((wiinst = kmalloc(sizeof(struct wiinst), GFP_KERNEL)) == NULL) {
                        ERROR();
                        kfree(wave_dev);
                        return -ENOMEM;
@@ -1204,7 +1211,7 @@ match:
                struct woinst *woinst;
                int i;
 
-               if ((woinst = (struct woinst *) kmalloc(sizeof(struct woinst), GFP_KERNEL)) == NULL) {
+               if ((woinst = kmalloc(sizeof(struct woinst), GFP_KERNEL)) == NULL) {
                        ERROR();
                        kfree(wave_dev);
                        return -ENOMEM;