summaryrefslogtreecommitdiff
path: root/drivers/mfd/twl4030-audio.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2012-09-10 14:46:20 +0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-09-18 17:29:27 +0400
commit39c1421db694ee2594bbb2196b1b5a3085e3c656 (patch)
tree856145f8995f99fe72f771743041ed808ac70c60 /drivers/mfd/twl4030-audio.c
parent41569a16e4e12910e14ce98edea9ef30bd89299b (diff)
downloadlinux-39c1421db694ee2594bbb2196b1b5a3085e3c656.tar.xz
mfd: twl4030-audio: Convert to use devm_kzalloc
To clean up the module probe and remove functions. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/twl4030-audio.c')
-rw-r--r--drivers/mfd/twl4030-audio.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c
index e330dfcc74e5..2ab8a1a96b91 100644
--- a/drivers/mfd/twl4030-audio.c
+++ b/drivers/mfd/twl4030-audio.c
@@ -188,7 +188,8 @@ static int __devinit twl4030_audio_probe(struct platform_device *pdev)
twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
val, TWL4030_REG_APLL_CTL);
- audio = kzalloc(sizeof(struct twl4030_audio), GFP_KERNEL);
+ audio = devm_kzalloc(&pdev->dev, sizeof(struct twl4030_audio),
+ GFP_KERNEL);
if (!audio)
return -ENOMEM;
@@ -229,22 +230,18 @@ static int __devinit twl4030_audio_probe(struct platform_device *pdev)
ret = -ENODEV;
}
- if (!ret)
- return 0;
+ if (ret) {
+ platform_set_drvdata(pdev, NULL);
+ twl4030_audio_dev = NULL;
+ }
- platform_set_drvdata(pdev, NULL);
- kfree(audio);
- twl4030_audio_dev = NULL;
return ret;
}
static int __devexit twl4030_audio_remove(struct platform_device *pdev)
{
- struct twl4030_audio *audio = platform_get_drvdata(pdev);
-
mfd_remove_devices(&pdev->dev);
platform_set_drvdata(pdev, NULL);
- kfree(audio);
twl4030_audio_dev = NULL;
return 0;