summaryrefslogtreecommitdiff
path: root/sound/isa/sb
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2009-04-10 05:43:36 +0400
committerTakashi Iwai <tiwai@suse.de>2009-04-14 14:39:23 +0400
commit68425adcc419bfe90776f59e66b8c4cdb6e1b1f3 (patch)
treeea68aa46121d17114732442d9730a22292606e46 /sound/isa/sb
parentef44a1ec6eeef189998f84e7230e1d3535b01074 (diff)
downloadlinux-68425adcc419bfe90776f59e66b8c4cdb6e1b1f3.tar.xz
ALSA: sound/isa: use memdup_user()
Remove open-coded memdup_user(). Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa/sb')
-rw-r--r--sound/isa/sb/sb16_csp.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c
index 49037d074c71..bdc8dde4e4a2 100644
--- a/sound/isa/sb/sb16_csp.c
+++ b/sound/isa/sb/sb16_csp.c
@@ -684,15 +684,16 @@ static int snd_sb_csp_load(struct snd_sb_csp * p, const unsigned char *buf, int
static int snd_sb_csp_load_user(struct snd_sb_csp * p, const unsigned char __user *buf, int size, int load_flags)
{
- int err = -ENOMEM;
- unsigned char *kbuf = kmalloc(size, GFP_KERNEL);
- if (kbuf) {
- if (copy_from_user(kbuf, buf, size))
- err = -EFAULT;
- else
- err = snd_sb_csp_load(p, kbuf, size, load_flags);
- kfree(kbuf);
- }
+ int err;
+ unsigned char *kbuf;
+
+ kbuf = memdup_user(buf, size);
+ if (IS_ERR(kbuf))
+ return PTR_ERR(kbuf);
+
+ err = snd_sb_csp_load(p, kbuf, size, load_flags);
+
+ kfree(kbuf);
return err;
}