diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2014-06-23 15:28:36 +0200 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2014-06-24 00:31:39 -0700 |
commit | 5f627170dfdc92fcd86abb878a6c93c88eb2a3e1 (patch) | |
tree | 958c549828a4e8b082aa9dc9493e4819dd0e094b /sound | |
parent | d8e3844571084c37b021fbd1efdd13c0db166aee (diff) | |
download | linux-3.10-5f627170dfdc92fcd86abb878a6c93c88eb2a3e1.tar.gz linux-3.10-5f627170dfdc92fcd86abb878a6c93c88eb2a3e1.tar.bz2 linux-3.10-5f627170dfdc92fcd86abb878a6c93c88eb2a3e1.zip |
ASoC: odroidx2_max98090: Add missing of_node_put() calls
Ensure the acquired references to the DT nodes are properly released
on error paths and upon the driver's removal.
Change-Id: I8ffff330041ad6d6adbc1afff3c85154e18dd85d
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/samsung/odroidx2_max98090.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/sound/soc/samsung/odroidx2_max98090.c b/sound/soc/samsung/odroidx2_max98090.c index 98caf9309cc..1e5f09b2ca6 100644 --- a/sound/soc/samsung/odroidx2_max98090.c +++ b/sound/soc/samsung/odroidx2_max98090.c @@ -80,6 +80,7 @@ static int odroidx2_audio_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct snd_soc_card *card = &odroidx2; + int ret; card->dev = &pdev->dev; @@ -96,7 +97,8 @@ static int odroidx2_audio_probe(struct platform_device *pdev) if (!odroidx2_dai[0].cpu_of_node) { dev_err(&pdev->dev, "Property 'samsung,i2s-controller' missing or invalid\n"); - return -EINVAL; + ret = -EINVAL; + goto err_put_cod_n; } odroidx2_dai[0].platform_of_node = odroidx2_dai[0].cpu_of_node; @@ -104,7 +106,19 @@ static int odroidx2_audio_probe(struct platform_device *pdev) /* Configure the secondary audio interface with the same codec dai */ odroidx2_dai[1].codec_of_node = odroidx2_dai[0].codec_of_node; - return snd_soc_register_card(card); + ret = snd_soc_register_card(card); + if (ret) { + dev_err(&pdev->dev, "snd_soc_register_card failed: %d\n", ret); + goto err_put_cpu_n; + } + + return 0; + +err_put_cpu_n: + of_node_put((struct device_node *)odroidx2_dai[0].cpu_of_node); +err_put_cod_n: + of_node_put((struct device_node *)odroidx2_dai[0].codec_of_node); + return ret; } static int odroidx2_audio_remove(struct platform_device *pdev) @@ -113,6 +127,9 @@ static int odroidx2_audio_remove(struct platform_device *pdev) snd_soc_unregister_card(card); + of_node_put((struct device_node *)odroidx2_dai[0].cpu_of_node); + of_node_put((struct device_node *)odroidx2_dai[0].codec_of_node); + return 0; } |