public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: SOF: topology: Fix missing error code in sof_route_load()
@ 2023-05-12  2:54 Jiapeng Chong
  2023-05-12 10:12 ` Péter Ujfalusi
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2023-05-12  2:54 UTC (permalink / raw)
  To: pierre-louis.bossart
  Cc: lgirdwood, peter.ujfalusi, yung-chuan.liao, ranjani.sridharan,
	kai.vehmanen, daniel.baluta, broonie, perex, tiwai,
	sound-open-firmware, alsa-devel, linux-kernel, Jiapeng Chong,
	Abaci Robot

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@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4935
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: SOF: topology: Fix missing error code in sof_route_load()
  2023-05-12  2:54 [PATCH] ASoC: SOF: topology: Fix missing error code in sof_route_load() Jiapeng Chong
@ 2023-05-12 10:12 ` Péter Ujfalusi
  0 siblings, 0 replies; 2+ messages in thread
From: Péter Ujfalusi @ 2023-05-12 10:12 UTC (permalink / raw)
  To: Jiapeng Chong, pierre-louis.bossart
  Cc: lgirdwood, yung-chuan.liao, ranjani.sridharan, kai.vehmanen,
	daniel.baluta, broonie, perex, tiwai, sound-open-firmware,
	alsa-devel, linux-kernel, Abaci Robot



On 12/05/2023 05:54, Jiapeng Chong wrote:
> 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@linux.alibaba.com>
Robots don't necessarily understand code...
The cases which this is aiming to fix are the cases when we ignore
things, not failing.

Would it be possible to check the code and understand it before sending
a patch?

Nack.

> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4935
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  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;
>  }
>
-- 
Péter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-12 10:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-12  2:54 [PATCH] ASoC: SOF: topology: Fix missing error code in sof_route_load() Jiapeng Chong
2023-05-12 10:12 ` Péter Ujfalusi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox