ASoC: fsl: fix -Wmaybe-uninitialized warning
Subsystems (4)
PATCH 1/1 ASoC: fsl: fix -Wmaybe-uninitialized warning
From: Arnd Bergmann <[email protected]>
Clang points out a code path that returns an undefined value in an error case:
sound/soc/fsl/imx-hdmi.c:165:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsom etimes-uninitialized]
if ((hdmi_out && hdmi_in) || (!hdmi_out && !hdmi_in)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/fsl/imx-hdmi.c:212:9: note: uninitialized use occurs here
return ret;The driver returns -EINVAL for other broken DT properties, so do it the same way here.
--- sound/soc/fsl/imx-hdmi.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/fsl/imx-hdmi.c +1 -0
@@ -164,6 +164,7 @@ static int imx_hdmi_probe(struct platform_device *pdev)if ((hdmi_out && hdmi_in) || (!hdmi_out && !hdmi_in)) {dev_err (&pdev->dev,"Invalid HDMI DAI link\n" ); + ret = -EINVAL ; goto fail; }
Signature · 1 line
2.29.2
Quoted 12 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Clang points out a code path that returns an undefined value in an error case:
sound/soc/fsl/imx-hdmi.c:165:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsom etimes-uninitialized]if ((hdmi_out && hdmi_in) || (!hdmi_out && !hdmi_in)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sound/soc/fsl/imx-hdmi.c:212:9: note: uninitialized use occurs here return ret;
Quoted 5 lines
The driver returns
-EINVALfor other broken DT properties, so do it the same way here.Fixes 6a5f850aa83a ("ASoC: fsl: Add imx-hdmi machine driver")Signed-off-by Arnd Bergmann <[email protected]>
Quoted 19 lines
--- sound/soc/fsl/imx-hdmi.c | 1 + 1 file changed, 1 insertion(+)sound/soc/fsl/imx-hdmi.c +1
-0@@ -164,6 +164,7 @@ static int imx_hdmi_probe(struct platform_device *pdev)if ((hdmi_out && hdmi_in) || (!hdmi_out && !hdmi_in)) {dev_err (&pdev->dev,"Invalid HDMI DAI link\n" ); + ret = -EINVAL ; goto fail; }Signature · 1 line
2.29.2
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Nicolin Chen
reviewerQuoted 26 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Clang points out a code path that returns an undefined value in an error case:
sound/soc/fsl/imx-hdmi.c:165:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsom etimes-uninitialized]if ((hdmi_out && hdmi_in) || (!hdmi_out && !hdmi_in)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sound/soc/fsl/imx-hdmi.c:212:9: note: uninitialized use occurs here return ret;The driver returns
-EINVALfor other broken DT properties, so do it the same way here.Fixes 6a5f850aa83a ("ASoC: fsl: Add imx-hdmi machine driver")Signed-off-by Arnd Bergmann <[email protected]>--- sound/soc/fsl/imx-hdmi.c | 1 + 1 file changed, 1 insertion(+)sound/soc/fsl/imx-hdmi.c +0
-0
sound/soc/fsl/imx-hdmi.c static int imx_hdmi_probe(struct platform_device *pdev) · line 168
Quoted 5 lines
sound/soc/fsl/imx-hdmi.c +1
-0@@ -164,6 +164,7 @@ static int imx_hdmi_probe(struct platform_device *pdev)if ((hdmi_out && hdmi_in) || (!hdmi_out && !hdmi_in)) {dev_err (&pdev->dev,"Invalid HDMI DAI link\n" ); + ret = -EINVAL ; goto fail;
I think Mark has already applied a fix :)
https://lkml.org/lkml/2020/12/16/275