mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 00:04:15 +08:00
ALSA: firewire: use kmemdup rather than duplicating its implementation
The patch was generated using fixed coccinelle semantic patch scripts/coccinelle/api/memdup.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320 Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
f6af5df0c7
commit
96bab82f6b
@ -512,12 +512,11 @@ assume_stream_formats(struct snd_oxfw *oxfw, enum avc_general_plug_dir dir,
|
||||
if (err < 0)
|
||||
goto end;
|
||||
|
||||
formats[eid] = kmalloc(*len, GFP_KERNEL);
|
||||
formats[eid] = kmemdup(buf, *len, GFP_KERNEL);
|
||||
if (formats[eid] == NULL) {
|
||||
err = -ENOMEM;
|
||||
goto end;
|
||||
}
|
||||
memcpy(formats[eid], buf, *len);
|
||||
|
||||
/* apply the format for each available sampling rate */
|
||||
for (i = 0; i < ARRAY_SIZE(oxfw_rate_table); i++) {
|
||||
@ -531,12 +530,11 @@ assume_stream_formats(struct snd_oxfw *oxfw, enum avc_general_plug_dir dir,
|
||||
continue;
|
||||
|
||||
eid++;
|
||||
formats[eid] = kmalloc(*len, GFP_KERNEL);
|
||||
formats[eid] = kmemdup(buf, *len, GFP_KERNEL);
|
||||
if (formats[eid] == NULL) {
|
||||
err = -ENOMEM;
|
||||
goto end;
|
||||
}
|
||||
memcpy(formats[eid], buf, *len);
|
||||
formats[eid][2] = avc_stream_rate_table[i];
|
||||
}
|
||||
|
||||
@ -594,12 +592,11 @@ static int fill_stream_formats(struct snd_oxfw *oxfw,
|
||||
if (err < 0)
|
||||
break;
|
||||
|
||||
formats[eid] = kmalloc(len, GFP_KERNEL);
|
||||
formats[eid] = kmemdup(buf, len, GFP_KERNEL);
|
||||
if (formats[eid] == NULL) {
|
||||
err = -ENOMEM;
|
||||
break;
|
||||
}
|
||||
memcpy(formats[eid], buf, len);
|
||||
|
||||
/* get next entry */
|
||||
len = AVC_GENERIC_FRAME_MAXIMUM_BYTES;
|
||||
|
Loading…
Reference in New Issue
Block a user