ASoC: simple-card: Fix bug of wrong decrement DT node's refcount

DAI links's cpu_of_node's and codec_of_node's refcounts shouldn't
be decremented immediately at the end of the probe() fucntion.
Because we will still use them before the audio card is removed.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Xiubo Li 2014-09-01 14:46:52 +08:00 committed by Mark Brown
parent 7d1311b93e
commit e3c4a28b61
1 changed files with 8 additions and 0 deletions

View File

@ -481,12 +481,19 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
snd_soc_card_set_drvdata(&priv->snd_card, priv); snd_soc_card_set_drvdata(&priv->snd_card, priv);
ret = devm_snd_soc_register_card(&pdev->dev, &priv->snd_card); ret = devm_snd_soc_register_card(&pdev->dev, &priv->snd_card);
if (ret >= 0)
return ret;
err: err:
asoc_simple_card_unref(pdev); asoc_simple_card_unref(pdev);
return ret; return ret;
} }
static int asoc_simple_card_remove(struct platform_device *pdev)
{
return asoc_simple_card_unref(pdev);
}
static const struct of_device_id asoc_simple_of_match[] = { static const struct of_device_id asoc_simple_of_match[] = {
{ .compatible = "simple-audio-card", }, { .compatible = "simple-audio-card", },
{}, {},
@ -500,6 +507,7 @@ static struct platform_driver asoc_simple_card = {
.of_match_table = asoc_simple_of_match, .of_match_table = asoc_simple_of_match,
}, },
.probe = asoc_simple_card_probe, .probe = asoc_simple_card_probe,
.remove = asoc_simple_card_remove,
}; };
module_platform_driver(asoc_simple_card); module_platform_driver(asoc_simple_card);