Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50d4a790 authored by Philipp Zabel's avatar Philipp Zabel Committed by Mark Brown
Browse files

ASoC: imx-sgtl5000: Fix uninitialized pointer use in error path



This patch avoids to dereference the uninitialized data pointer if the
error path is entered before devm_kzalloc is called (or if the allocation
fails). It fixes the following warning:

    sound/soc/fsl/imx-sgtl5000.c: In function 'imx_sgtl5000_probe':
    sound/soc/fsl/imx-sgtl5000.c:175:18: warning: 'data' may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent a8b22c1c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
	struct device_node *ssi_np, *codec_np;
	struct platform_device *ssi_pdev;
	struct i2c_client *codec_dev;
	struct imx_sgtl5000_data *data;
	struct imx_sgtl5000_data *data = NULL;
	int int_port, ext_port;
	int ret;

@@ -172,7 +172,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
	return 0;

fail:
	if (!IS_ERR(data->codec_clk))
	if (data && !IS_ERR(data->codec_clk))
		clk_put(data->codec_clk);
	if (ssi_np)
		of_node_put(ssi_np);