[alsa-devel] [PATCH] ASoC: Augment existing card DAPM routes in snd_soc_of_parse_audio_routing

Mark Brown broonie at kernel.org
Fri Nov 28 17:03:20 CET 2014


On Thu, Nov 27, 2014 at 10:02:42PM +0100, Peter Rosin wrote:

> -	routes = devm_kzalloc(card->dev, num_routes * sizeof(*routes),
> +	old_routes = card->num_dapm_routes;
> +	routes = devm_kzalloc(card->dev,
> +			      (old_routes + num_routes) * sizeof(*routes),
>  			      GFP_KERNEL);
>  	if (!routes) {
>  		dev_err(card->dev,
> @@ -4611,9 +4613,11 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
>  		return -EINVAL;
>  	}
>  
> +	memcpy(routes, card->dapm_routes, old_routes * sizeof(*routes));
> +

Aren't we open coding krealloc() here?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20141128/dba6348e/attachment.sig>


More information about the Alsa-devel mailing list