Skip to content

Commit

Permalink
ASoC: imx-sgtl5000: Fix uninitialized pointer use in error path
Browse files Browse the repository at this point in the history
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: Philipp Zabel <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
pH5 authored and broonie committed Sep 26, 2013
1 parent a8b22c1 commit 50d4a79
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sound/soc/fsl/imx-sgtl5000.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 50d4a79

Please sign in to comment.