diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2006-10-01 02:27:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-01 03:39:19 -0400 |
commit | 52978be636374c4bfb61220b37fa12f55a071c46 (patch) | |
tree | 36444be7bdbc0cdd99d903c0ad87316c93427517 /sound | |
parent | 1a2f67b459bb7846d4a15924face63eb2683acc2 (diff) |
[PATCH] kmemdup: some users
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/echoaudio/layla24_dsp.c | 4 | ||||
-rw-r--r-- | sound/usb/usbaudio.c | 11 | ||||
-rw-r--r-- | sound/usb/usbmidi.c | 3 |
3 files changed, 7 insertions, 11 deletions
diff --git a/sound/pci/echoaudio/layla24_dsp.c b/sound/pci/echoaudio/layla24_dsp.c index 7ec5b63d0dce..97e42e115147 100644 --- a/sound/pci/echoaudio/layla24_dsp.c +++ b/sound/pci/echoaudio/layla24_dsp.c | |||
@@ -302,11 +302,11 @@ static int switch_asic(struct echoaudio *chip, const struct firmware *asic) | |||
302 | 302 | ||
303 | /* Check to see if this is already loaded */ | 303 | /* Check to see if this is already loaded */ |
304 | if (asic != chip->asic_code) { | 304 | if (asic != chip->asic_code) { |
305 | monitors = kmalloc(MONITOR_ARRAY_SIZE, GFP_KERNEL); | 305 | monitors = kmemdup(chip->comm_page->monitors, |
306 | MONITOR_ARRAY_SIZE, GFP_KERNEL); | ||
306 | if (! monitors) | 307 | if (! monitors) |
307 | return -ENOMEM; | 308 | return -ENOMEM; |
308 | 309 | ||
309 | memcpy(monitors, chip->comm_page->monitors, MONITOR_ARRAY_SIZE); | ||
310 | memset(chip->comm_page->monitors, ECHOGAIN_MUTED, | 310 | memset(chip->comm_page->monitors, ECHOGAIN_MUTED, |
311 | MONITOR_ARRAY_SIZE); | 311 | MONITOR_ARRAY_SIZE); |
312 | 312 | ||
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 49248fa7aef4..a42acf6d7b68 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -2046,10 +2046,9 @@ int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, __u8 request, | |||
2046 | void *buf = NULL; | 2046 | void *buf = NULL; |
2047 | 2047 | ||
2048 | if (size > 0) { | 2048 | if (size > 0) { |
2049 | buf = kmalloc(size, GFP_KERNEL); | 2049 | buf = kmemdup(data, size, GFP_KERNEL); |
2050 | if (!buf) | 2050 | if (!buf) |
2051 | return -ENOMEM; | 2051 | return -ENOMEM; |
2052 | memcpy(buf, data, size); | ||
2053 | } | 2052 | } |
2054 | err = usb_control_msg(dev, pipe, request, requesttype, | 2053 | err = usb_control_msg(dev, pipe, request, requesttype, |
2055 | value, index, buf, size, timeout); | 2054 | value, index, buf, size, timeout); |
@@ -2846,12 +2845,11 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, | |||
2846 | int stream, err; | 2845 | int stream, err; |
2847 | int *rate_table = NULL; | 2846 | int *rate_table = NULL; |
2848 | 2847 | ||
2849 | fp = kmalloc(sizeof(*fp), GFP_KERNEL); | 2848 | fp = kmemdup(quirk->data, sizeof(*fp), GFP_KERNEL); |
2850 | if (! fp) { | 2849 | if (! fp) { |
2851 | snd_printk(KERN_ERR "cannot malloc\n"); | 2850 | snd_printk(KERN_ERR "cannot memdup\n"); |
2852 | return -ENOMEM; | 2851 | return -ENOMEM; |
2853 | } | 2852 | } |
2854 | memcpy(fp, quirk->data, sizeof(*fp)); | ||
2855 | if (fp->nr_rates > 0) { | 2853 | if (fp->nr_rates > 0) { |
2856 | rate_table = kmalloc(sizeof(int) * fp->nr_rates, GFP_KERNEL); | 2854 | rate_table = kmalloc(sizeof(int) * fp->nr_rates, GFP_KERNEL); |
2857 | if (!rate_table) { | 2855 | if (!rate_table) { |
@@ -3029,10 +3027,9 @@ static int create_ua1000_quirk(struct snd_usb_audio *chip, | |||
3029 | altsd->bNumEndpoints != 1) | 3027 | altsd->bNumEndpoints != 1) |
3030 | return -ENXIO; | 3028 | return -ENXIO; |
3031 | 3029 | ||
3032 | fp = kmalloc(sizeof(*fp), GFP_KERNEL); | 3030 | fp = kmemdup(&ua1000_format, sizeof(*fp), GFP_KERNEL); |
3033 | if (!fp) | 3031 | if (!fp) |
3034 | return -ENOMEM; | 3032 | return -ENOMEM; |
3035 | memcpy(fp, &ua1000_format, sizeof(*fp)); | ||
3036 | 3033 | ||
3037 | fp->channels = alts->extra[4]; | 3034 | fp->channels = alts->extra[4]; |
3038 | fp->iface = altsd->bInterfaceNumber; | 3035 | fp->iface = altsd->bInterfaceNumber; |
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index abe29dadd979..0dcf78adb99a 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -323,10 +323,9 @@ static int send_bulk_static_data(struct snd_usb_midi_out_endpoint* ep, | |||
323 | const void *data, int len) | 323 | const void *data, int len) |
324 | { | 324 | { |
325 | int err; | 325 | int err; |
326 | void *buf = kmalloc(len, GFP_KERNEL); | 326 | void *buf = kmemdup(data, len, GFP_KERNEL); |
327 | if (!buf) | 327 | if (!buf) |
328 | return -ENOMEM; | 328 | return -ENOMEM; |
329 | memcpy(buf, data, len); | ||
330 | dump_urb("sending", buf, len); | 329 | dump_urb("sending", buf, len); |
331 | err = usb_bulk_msg(ep->umidi->chip->dev, ep->urb->pipe, buf, len, | 330 | err = usb_bulk_msg(ep->umidi->chip->dev, ep->urb->pipe, buf, len, |
332 | NULL, 250); | 331 | NULL, 250); |