ASoC: davinci - Fix possible NULL derefrence.
of_match_device could return NULL, and so can cause a NULL pointer dereference later. Signed-off-by: Shailendra Verma <shailendra.v@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
a5de5b74a5
commit
3f81d9aa80
|
@ -358,13 +358,20 @@ static struct snd_soc_card evm_soc_card = {
|
||||||
static int davinci_evm_probe(struct platform_device *pdev)
|
static int davinci_evm_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device_node *np = pdev->dev.of_node;
|
struct device_node *np = pdev->dev.of_node;
|
||||||
const struct of_device_id *match =
|
const struct of_device_id *match;
|
||||||
of_match_device(of_match_ptr(davinci_evm_dt_ids), &pdev->dev);
|
struct snd_soc_dai_link *dai;
|
||||||
struct snd_soc_dai_link *dai = (struct snd_soc_dai_link *) match->data;
|
|
||||||
struct snd_soc_card_drvdata_davinci *drvdata = NULL;
|
struct snd_soc_card_drvdata_davinci *drvdata = NULL;
|
||||||
struct clk *mclk;
|
struct clk *mclk;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
match = of_match_device(of_match_ptr(davinci_evm_dt_ids), &pdev->dev);
|
||||||
|
if (!match) {
|
||||||
|
dev_err(&pdev->dev, "Error: No device match found\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
dai = (struct snd_soc_dai_link *) match->data;
|
||||||
|
|
||||||
evm_soc_card.dai_link = dai;
|
evm_soc_card.dai_link = dai;
|
||||||
|
|
||||||
dai->codec_of_node = of_parse_phandle(np, "ti,audio-codec", 0);
|
dai->codec_of_node = of_parse_phandle(np, "ti,audio-codec", 0);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user