diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2012-09-10 06:46:20 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-09-18 09:29:27 -0400 |
commit | 39c1421db694ee2594bbb2196b1b5a3085e3c656 (patch) | |
tree | 856145f8995f99fe72f771743041ed808ac70c60 | |
parent | 41569a16e4e12910e14ce98edea9ef30bd89299b (diff) |
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>
-rw-r--r-- | drivers/mfd/twl4030-audio.c | 15 |
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) | |||
188 | twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, | 188 | twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, |
189 | val, TWL4030_REG_APLL_CTL); | 189 | val, TWL4030_REG_APLL_CTL); |
190 | 190 | ||
191 | audio = kzalloc(sizeof(struct twl4030_audio), GFP_KERNEL); | 191 | audio = devm_kzalloc(&pdev->dev, sizeof(struct twl4030_audio), |
192 | GFP_KERNEL); | ||
192 | if (!audio) | 193 | if (!audio) |
193 | return -ENOMEM; | 194 | return -ENOMEM; |
194 | 195 | ||
@@ -229,22 +230,18 @@ static int __devinit twl4030_audio_probe(struct platform_device *pdev) | |||
229 | ret = -ENODEV; | 230 | ret = -ENODEV; |
230 | } | 231 | } |
231 | 232 | ||
232 | if (!ret) | 233 | if (ret) { |
233 | return 0; | 234 | platform_set_drvdata(pdev, NULL); |
235 | twl4030_audio_dev = NULL; | ||
236 | } | ||
234 | 237 | ||
235 | platform_set_drvdata(pdev, NULL); | ||
236 | kfree(audio); | ||
237 | twl4030_audio_dev = NULL; | ||
238 | return ret; | 238 | return ret; |
239 | } | 239 | } |
240 | 240 | ||
241 | static int __devexit twl4030_audio_remove(struct platform_device *pdev) | 241 | static int __devexit twl4030_audio_remove(struct platform_device *pdev) |
242 | { | 242 | { |
243 | struct twl4030_audio *audio = platform_get_drvdata(pdev); | ||
244 | |||
245 | mfd_remove_devices(&pdev->dev); | 243 | mfd_remove_devices(&pdev->dev); |
246 | platform_set_drvdata(pdev, NULL); | 244 | platform_set_drvdata(pdev, NULL); |
247 | kfree(audio); | ||
248 | twl4030_audio_dev = NULL; | 245 | twl4030_audio_dev = NULL; |
249 | 246 | ||
250 | return 0; | 247 | return 0; |