All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Beer <daniel.beer@igorinstitute.com>
To: Li Zetao <lizetao1@huawei.com>
Cc: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
	tiwai@suse.com, pierre-louis.bossart@linux.intel.com,
	peter.ujfalusi@linux.intel.com, yung-chuan.liao@linux.intel.com,
	ranjani.sridharan@linux.intel.com, daniel.baluta@nxp.com,
	kai.vehmanen@linux.intel.com, Jonathan.Cameron@huawei.com,
	luca.ceresoli@bootlin.com, luzmaximilian@gmail.com,
	u.kleine-koenig@pengutronix.de, alsa-devel@alsa-project.org,
	sound-open-firmware@alsa-project.org
Subject: Re: [PATCH -next 1/2] ASoC: tas5805m: Use devm_kmemdup to replace devm_kmalloc + memcpy
Date: Fri, 11 Aug 2023 06:55:30 +1200	[thread overview]
Message-ID: <ZNUyor9WYmeBrxg/@fermat.nev> (raw)
In-Reply-To: <20230810114738.2103792-2-lizetao1@huawei.com>

On Thu, Aug 10, 2023 at 07:47:37PM +0800, Li Zetao wrote:
> -	tas5805m->dsp_cfg_data = devm_kmalloc(dev, fw->size, GFP_KERNEL);
> +	tas5805m->dsp_cfg_data = devm_kmemdup(dev, fw->data, fw->size, GFP_KERNEL);
>  	if (!tas5805m->dsp_cfg_data) {
>  		release_firmware(fw);
>  		return -ENOMEM;
>  	}
> -	memcpy(tas5805m->dsp_cfg_data, fw->data, fw->size);
>  
>  	release_firmware(fw);

You could probably now move the release_firmware call to be immediately
after the devm_kmemdup attempt, and avoid having to call it from two
different places.

Cheers,
Daniel

-- 
Daniel Beer
Firmware Engineer at Igor Institute
daniel.beer@igorinstitute.com or +64-27-420-8101
Offices in Seattle, San Francisco, and Vancouver BC or (206) 494-3312

  reply	other threads:[~2023-08-10 18:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10 11:47 [PATCH -next 0/2] Use devm_kmemdup to replace devm_kmalloc + memcpy Li Zetao
2023-08-10 11:47 ` [PATCH -next 1/2] ASoC: tas5805m: " Li Zetao
2023-08-10 18:55   ` Daniel Beer [this message]
2023-08-10 11:47 ` [PATCH -next 2/2] ASoC: SOF: ipc3: " Li Zetao
2023-08-11 15:32   ` Luca Ceresoli
2023-08-15 19:17 ` [PATCH -next 0/2] " Mark Brown

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=ZNUyor9WYmeBrxg/@fermat.nev \
    --to=daniel.beer@igorinstitute.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=daniel.baluta@nxp.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=lizetao1@huawei.com \
    --cc=luca.ceresoli@bootlin.com \
    --cc=luzmaximilian@gmail.com \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=sound-open-firmware@alsa-project.org \
    --cc=tiwai@suse.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=yung-chuan.liao@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.