Skip to content

Commit

Permalink
ASoC: mc13783: Ensure we only try to dereference valid of_nodes
Browse files Browse the repository at this point in the history
Reported-by: Takashi Iwai <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
broonie committed Oct 8, 2014
1 parent a5448c8 commit a66ae63
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions sound/soc/codecs/mc13783.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,12 +765,18 @@ static int __init mc13783_codec_probe(struct platform_device *pdev)
return -ENOSYS;

ret = of_property_read_u32(np, "adc-port", &priv->adc_ssi_port);
if (ret)
goto out;
if (ret) {
of_node_put(np);
return ret;
}

ret = of_property_read_u32(np, "dac-port", &priv->dac_ssi_port);
if (ret)
goto out;
if (ret) {
of_node_put(np);
return ret;
}

of_node_put(np);
}

dev_set_drvdata(&pdev->dev, priv);
Expand All @@ -783,8 +789,6 @@ static int __init mc13783_codec_probe(struct platform_device *pdev)
ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_mc13783,
mc13783_dai_async, ARRAY_SIZE(mc13783_dai_async));

out:
of_node_put(np);
return ret;
}

Expand Down

0 comments on commit a66ae63

Please sign in to comment.