* [PATCH] ASoC: mediatek: mt8188-mt6359: Fix error code in codec_init
@ 2023-06-07 9:41 Dan Carpenter
2023-06-07 10:30 ` Trevor Wu (吳文良)
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2023-06-07 9:41 UTC (permalink / raw)
To: Trevor Wu
Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Matthias Brugger, AngeloGioacchino Del Regno, Alexandre Mergnat,
alsa-devel, linux-arm-kernel, linux-mediatek, kernel-janitors
Return -EINVAL on this error path instead of returning success.
Fixes: 9f08dcbddeb3 ("ASoC: mediatek: mt8188-mt6359: support new board with nau88255")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
This is based on static analysis and not tested.
sound/soc/mediatek/mt8188/mt8188-mt6359.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/mediatek/mt8188/mt8188-mt6359.c b/sound/soc/mediatek/mt8188/mt8188-mt6359.c
index bc4b74970a46..ae02bbcd5d4e 100644
--- a/sound/soc/mediatek/mt8188/mt8188-mt6359.c
+++ b/sound/soc/mediatek/mt8188/mt8188-mt6359.c
@@ -594,7 +594,7 @@ static int mt8188_max98390_codec_init(struct snd_soc_pcm_runtime *rtd)
}
if (rtd->dai_link->num_codecs <= 2)
- return ret;
+ return -EINVAL;
/* add widgets/controls/dapm for rear speakers */
ret = snd_soc_dapm_new_controls(&card->dapm, mt8188_rear_spk_widgets,
--
2.39.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ASoC: mediatek: mt8188-mt6359: Fix error code in codec_init
2023-06-07 9:41 [PATCH] ASoC: mediatek: mt8188-mt6359: Fix error code in codec_init Dan Carpenter
@ 2023-06-07 10:30 ` Trevor Wu (吳文良)
2023-06-07 10:48 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Trevor Wu (吳文良) @ 2023-06-07 10:30 UTC (permalink / raw)
To: dan.carpenter@linaro.org
Cc: kernel-janitors@vger.kernel.org,
linux-mediatek@lists.infradead.org, broonie@kernel.org,
tiwai@suse.com, amergnat@baylibre.com, lgirdwood@gmail.com,
linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com,
perex@perex.cz, alsa-devel@alsa-project.org,
angelogioacchino.delregno@collabora.com
On Wed, 2023-06-07 at 12:41 +0300, Dan Carpenter wrote:
> Return -EINVAL on this error path instead of returning success.
Hi Dan,
I intended for the function to be reusable by both 2 and 4 amps, which
is why I added a condition in the middle.
This shouldn't be considered an error case, so there is no need to
return -EINVAL here.
Please kindly inform me if there are any errors in my understanding.
Thanks,
Trevor
>
> Fixes: 9f08dcbddeb3 ("ASoC: mediatek: mt8188-mt6359: support new
> board with nau88255")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> This is based on static analysis and not tested.
>
> sound/soc/mediatek/mt8188/mt8188-mt6359.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/mediatek/mt8188/mt8188-mt6359.c
> b/sound/soc/mediatek/mt8188/mt8188-mt6359.c
> index bc4b74970a46..ae02bbcd5d4e 100644
> --- a/sound/soc/mediatek/mt8188/mt8188-mt6359.c
> +++ b/sound/soc/mediatek/mt8188/mt8188-mt6359.c
> @@ -594,7 +594,7 @@ static int mt8188_max98390_codec_init(struct
> snd_soc_pcm_runtime *rtd)
> }
>
> if (rtd->dai_link->num_codecs <= 2)
> -return ret;
> +return -EINVAL;
>
> /* add widgets/controls/dapm for rear speakers */
> ret = snd_soc_dapm_new_controls(&card->dapm,
> mt8188_rear_spk_widgets,
> --
> 2.39.2
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ASoC: mediatek: mt8188-mt6359: Fix error code in codec_init
2023-06-07 10:30 ` Trevor Wu (吳文良)
@ 2023-06-07 10:48 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2023-06-07 10:48 UTC (permalink / raw)
To: Trevor Wu (吳文良)
Cc: kernel-janitors@vger.kernel.org,
linux-mediatek@lists.infradead.org, broonie@kernel.org,
tiwai@suse.com, amergnat@baylibre.com, lgirdwood@gmail.com,
linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com,
perex@perex.cz, alsa-devel@alsa-project.org,
angelogioacchino.delregno@collabora.com
On Wed, Jun 07, 2023 at 10:30:05AM +0000, Trevor Wu (吳文良) wrote:
> On Wed, 2023-06-07 at 12:41 +0300, Dan Carpenter wrote:
> > Return -EINVAL on this error path instead of returning success.
>
> Hi Dan,
>
> I intended for the function to be reusable by both 2 and 4 amps, which
> is why I added a condition in the middle.
> This shouldn't be considered an error case, so there is no need to
> return -EINVAL here.
> Please kindly inform me if there are any errors in my understanding.
Oh, it looked like an error path. Let me change it to "return 0;".
regards,
dan carpenter
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-07 10:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-07 9:41 [PATCH] ASoC: mediatek: mt8188-mt6359: Fix error code in codec_init Dan Carpenter
2023-06-07 10:30 ` Trevor Wu (吳文良)
2023-06-07 10:48 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox