# \[PATCH 5.12 099/292\] ASoC: soc-core: Fix the error return code in snd\_soc\_of\_parse\_audio\_routing()

- From: Greg Kroah-Hartman \<gregkh@linuxfoundation.org\>
- Date: 2021-07-19 18:01:05 
- List: stable
- Page: https://ratatoskr.run/stable/2021/07/1451284
- Thread: https://ratatoskr.run/stable/2021/07/1451205/t/2.md

```text
From: Zhen Lei <redacted>

[ Upstream commit 7d3865a10b9ff2669c531d5ddd60bf46b3d48f1e ]

When devm_kcalloc() fails, the error code -ENOMEM should be returned
instead of -EINVAL.

Signed-off-by: Zhen Lei <redacted>
Link: https://lore.kernel.org/r/20210617103729.1918-1-thunder.leizhen@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/soc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 6680c12716d4..6d4b08e918de 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2796,7 +2796,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 	if (!routes) {
 		dev_err(card->dev,
 			"ASoC: Could not allocate DAPM route table\n");
-		return -EINVAL;
+		return -ENOMEM;
 	}
 
 	for (i = 0; i < num_routes; i++) {
-- 
2.30.2



```
