Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1202407 > unrolled thread
| Started by | Andrzej Hajda <a.hajda@samsung.com> |
|---|---|
| First post | 2015-08-07 10:10 +0200 |
| Last post | 2015-08-07 15:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 29/31] sound/oxfw: use kmemdup rather than duplicating its implementation Andrzej Hajda <a.hajda@samsung.com> - 2015-08-07 10:10 +0200
Re: [alsa-devel] [PATCH 29/31] sound/oxfw: use kmemdup rather than duplicating its implementation Takashi Iwai <tiwai@suse.de> - 2015-08-07 15:00 +0200
| From | Andrzej Hajda <a.hajda@samsung.com> |
|---|---|
| Date | 2015-08-07 10:10 +0200 |
| Subject | [PATCH 29/31] sound/oxfw: use kmemdup rather than duplicating its implementation |
| Message-ID | <pUKT0-21E-15@gated-at.bofh.it> |
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>
---
sound/firewire/oxfw/oxfw-stream.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/sound/firewire/oxfw/oxfw-stream.c b/sound/firewire/oxfw/oxfw-stream.c
index 873d40f..77ad5b9 100644
--- a/sound/firewire/oxfw/oxfw-stream.c
+++ b/sound/firewire/oxfw/oxfw-stream.c
@@ -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;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Takashi Iwai <tiwai@suse.de> |
|---|---|
| Date | 2015-08-07 15:00 +0200 |
| Subject | Re: [alsa-devel] [PATCH 29/31] sound/oxfw: use kmemdup rather than duplicating its implementation |
| Message-ID | <pUPpD-8l0-1@gated-at.bofh.it> |
| In reply to | #1202407 |
On Fri, 07 Aug 2015 09:59:35 +0200,
Andrzej Hajda wrote:
>
> 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>
Applied, thanks.
Takashi
> ---
> sound/firewire/oxfw/oxfw-stream.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/sound/firewire/oxfw/oxfw-stream.c b/sound/firewire/oxfw/oxfw-stream.c
> index 873d40f..77ad5b9 100644
> --- a/sound/firewire/oxfw/oxfw-stream.c
> +++ b/sound/firewire/oxfw/oxfw-stream.c
> @@ -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;
> --
> 1.9.1
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web