Re: [PATCH] ASoC: Augment existing card DAPM routes in snd_soc_of_parse_audio_routing

From: Mark Brown
Date: Fri Nov 28 2014 - 11:03:38 EST


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?

Attachment: signature.asc
Description: Digital signature