summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2014-06-23 15:28:36 +0200
committerChanho Park <chanho61.park@samsung.com>2014-11-18 11:59:52 +0900
commit618e9b3f2921b685e6144150adf7153becd7f3e9 (patch)
tree069d2a6790555295ed05c40dac262d1b05eca82a /sound
parent2176c2b4e42878943fb98bc2add2c9c94aef8fb2 (diff)
downloadlinux-3.10-618e9b3f2921b685e6144150adf7153becd7f3e9.tar.gz
linux-3.10-618e9b3f2921b685e6144150adf7153becd7f3e9.tar.bz2
linux-3.10-618e9b3f2921b685e6144150adf7153becd7f3e9.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.c21
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;
}