From: Takashi Iwai <tiwai@suse.de>
To: Thomas Meyer <thomas@m3y3r.de>
Cc: Jaroslav Kysela <perex@perex.cz>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: usb-audio: Use kmemdup rather than duplicating its implementation
Date: Thu, 10 Nov 2011 19:53:30 +0100 [thread overview]
Message-ID: <s5hr51fdd1x.wl%tiwai@suse.de> (raw)
In-Reply-To: <1320950323.20155.106.camel@localhost.localdomain>
At Thu, 10 Nov 2011 19:38:43 +0100,
Thomas Meyer wrote:
>
> Use kmemdup rather than duplicating its implementation
>
> The semantic patch that makes this change is available
> in scripts/coccinelle/api/memdup.cocci.
>
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Thanks, applied now.
Takashi
> ---
>
> diff -u -p a/sound/usb/quirks.c b/sound/usb/quirks.c
> --- a/sound/usb/quirks.c 2011-11-07 19:38:37.987378553 +0100
> +++ b/sound/usb/quirks.c 2011-11-08 11:06:23.015258350 +0100
> @@ -137,12 +137,12 @@ static int create_fixed_stream_quirk(str
> return -ENOMEM;
> }
> if (fp->nr_rates > 0) {
> - rate_table = kmalloc(sizeof(int) * fp->nr_rates, GFP_KERNEL);
> + rate_table = kmemdup(fp->rate_table,
> + sizeof(int) * fp->nr_rates, GFP_KERNEL);
> if (!rate_table) {
> kfree(fp);
> return -ENOMEM;
> }
> - memcpy(rate_table, fp->rate_table, sizeof(int) * fp->nr_rates);
> fp->rate_table = rate_table;
> }
>
> @@ -224,10 +224,9 @@ static int create_uaxx_quirk(struct snd_
> if (altsd->bNumEndpoints != 1)
> return -ENXIO;
>
> - fp = kmalloc(sizeof(*fp), GFP_KERNEL);
> + fp = kmemdup(&ua_format, sizeof(*fp), GFP_KERNEL);
> if (!fp)
> return -ENOMEM;
> - memcpy(fp, &ua_format, sizeof(*fp));
>
> fp->iface = altsd->bInterfaceNumber;
> fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress;
> .
>
prev parent reply other threads:[~2011-11-10 18:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-10 18:38 Thomas Meyer
2011-11-10 18:53 ` Takashi Iwai [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hr51fdd1x.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=thomas@m3y3r.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®