X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=sound%2Foss%2Femu10k1%2Faudio.c;h=e75ea21eb8117fd67558b4d64328f18c806035be;hb=9c2e08c592cd357a8330c34def1e8ecfdcf53275;hp=86dd23974e055110817c5d6a3f8e03664d487f2a;hpb=ec0bf39a471bf6fcd01def2bd677128cea940b73;p=linux-2.6-omap-h63xx.git diff --git a/sound/oss/emu10k1/audio.c b/sound/oss/emu10k1/audio.c index 86dd23974e0..e75ea21eb81 100644 --- a/sound/oss/emu10k1/audio.c +++ b/sound/oss/emu10k1/audio.c @@ -111,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; @@ -1133,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(); @@ -1149,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; @@ -1205,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; @@ -1576,7 +1582,7 @@ static void emu10k1_waveout_bh(unsigned long refdata) return; } -struct file_operations emu10k1_audio_fops = { +const struct file_operations emu10k1_audio_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .read = emu10k1_audio_read,