Commit b761c0ca authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Mark Brown

ASoC: Free memory in the error paths of soc_of_parse_audio_routing()

Release the memory of the routing table before leaving the function upon errors
in the device tree
Signed-off-by: default avatarMatthias Kaehlcke <matthias@kaehlcke.net>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 5c6af635
...@@ -4136,6 +4136,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, ...@@ -4136,6 +4136,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
dev_err(card->dev, dev_err(card->dev,
"Property '%s' index %d could not be read: %d\n", "Property '%s' index %d could not be read: %d\n",
propname, 2 * i, ret); propname, 2 * i, ret);
kfree(routes);
return -EINVAL; return -EINVAL;
} }
ret = of_property_read_string_index(np, propname, ret = of_property_read_string_index(np, propname,
...@@ -4144,6 +4145,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, ...@@ -4144,6 +4145,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
dev_err(card->dev, dev_err(card->dev,
"Property '%s' index %d could not be read: %d\n", "Property '%s' index %d could not be read: %d\n",
propname, (2 * i) + 1, ret); propname, (2 * i) + 1, ret);
kfree(routes);
return -EINVAL; return -EINVAL;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment