[PATCH] ASoC: SOF: topology: Fix missing error code in sof_route_load()

From: Jiapeng Chong
Date: Thu May 11 2023 - 22:54:22 EST


The error code is missing in this code scenario, add the error code
'-EINVAL' to the return value 'err'.

sound/soc/sof/topology.c:2060 sof_route_load() warn: missing error code 'ret'.

Reported-by: Abaci Robot <abaci@xxxxxxxxxxxxxxxxx>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4935
Signed-off-by: Jiapeng Chong <jiapeng.chong@xxxxxxxxxxxxxxxxx>
---
sound/soc/sof/topology.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index d3d536b0a8f5..3ca3a72f1805 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -2045,7 +2045,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
if (!source_swidget) {
dev_err(scomp->dev, "error: source %s not found\n",
route->source);
- ret = -EINVAL;
goto err;
}

@@ -2064,7 +2063,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
if (!sink_swidget) {
dev_err(scomp->dev, "error: sink %s not found\n",
route->sink);
- ret = -EINVAL;
goto err;
}

@@ -2087,6 +2085,8 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
return 0;
err:
kfree(sroute);
+ ret = -EINVAL;
+
return ret;
}

--
2.20.1.7.g153144c