aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2012-09-10 06:46:20 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-09-22 11:14:40 -0400
commitbade699c67d40b785e00738b0593c7ed1dad78fc (patch)
tree63cd034505a319b518b9b2f1e328fc8bb256e577
parent9232aa507fa1707338873430cc404d8f92269e69 (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> Acked-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-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 ac04b4f2a53a..efa2d424b416 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
241static int __devexit twl4030_audio_remove(struct platform_device *pdev) 241static 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;