diff options
author | Julia Lawall <julia.lawall@lip6.fr> | 2011-12-29 17:51:20 +0100 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-02 13:07:46 +0000 |
commit | a3bb8f3f818667872728085497b3a3ab3caba371 (patch) | |
tree | e1194e253c5ffab4b59e50b3f39a71f9bae772ab /sound/soc/davinci | |
parent | 6945e9f9dfee897891a8ac620ce1621a2daf7e02 (diff) | |
download | blackbird-op-linux-a3bb8f3f818667872728085497b3a3ab3caba371.tar.gz blackbird-op-linux-a3bb8f3f818667872728085497b3a3ab3caba371.zip |
ASoC: davinci-vcif.c: use devm_ functions
The various devm_ functions allocate memory that is released when a driver
detaches. This patch uses devm_kzalloc, devm_request_mem_region and
devm_ioremap for data that is allocated in the probe function of a platform
device and is only freed in the remove function.
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/davinci')
-rw-r--r-- | sound/soc/davinci/davinci-vcif.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/sound/soc/davinci/davinci-vcif.c b/sound/soc/davinci/davinci-vcif.c index 70ce10c5d998..da030ff883d5 100644 --- a/sound/soc/davinci/davinci-vcif.c +++ b/sound/soc/davinci/davinci-vcif.c @@ -210,7 +210,9 @@ static int davinci_vcif_probe(struct platform_device *pdev) struct davinci_vcif_dev *davinci_vcif_dev; int ret; - davinci_vcif_dev = kzalloc(sizeof(struct davinci_vcif_dev), GFP_KERNEL); + davinci_vcif_dev = devm_kzalloc(&pdev->dev, + sizeof(struct davinci_vcif_dev), + GFP_KERNEL); if (!davinci_vcif_dev) { dev_dbg(&pdev->dev, "could not allocate memory for private data\n"); @@ -235,23 +237,15 @@ static int davinci_vcif_probe(struct platform_device *pdev) ret = snd_soc_register_dai(&pdev->dev, &davinci_vcif_dai); if (ret != 0) { dev_err(&pdev->dev, "could not register dai\n"); - goto fail; + return ret; } return 0; - -fail: - kfree(davinci_vcif_dev); - - return ret; } static int davinci_vcif_remove(struct platform_device *pdev) { - struct davinci_vcif_dev *davinci_vcif_dev = dev_get_drvdata(&pdev->dev); - snd_soc_unregister_dai(&pdev->dev); - kfree(davinci_vcif_dev); return 0; } |