提交 bade699c 编写于 作者: P Peter Ujfalusi 提交者: Mark Brown

mfd: twl4030-audio: Convert to use devm_kzalloc

To clean up the module probe and remove functions.
Signed-off-by: NPeter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: NSamuel Ortiz <sameo@linux.intel.com>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 9232aa50
...@@ -188,7 +188,8 @@ static int __devinit twl4030_audio_probe(struct platform_device *pdev) ...@@ -188,7 +188,8 @@ static int __devinit twl4030_audio_probe(struct platform_device *pdev)
twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
val, TWL4030_REG_APLL_CTL); 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) if (!audio)
return -ENOMEM; return -ENOMEM;
...@@ -229,22 +230,18 @@ static int __devinit twl4030_audio_probe(struct platform_device *pdev) ...@@ -229,22 +230,18 @@ static int __devinit twl4030_audio_probe(struct platform_device *pdev)
ret = -ENODEV; ret = -ENODEV;
} }
if (!ret) if (ret) {
return 0; platform_set_drvdata(pdev, NULL);
twl4030_audio_dev = NULL;
}
platform_set_drvdata(pdev, NULL);
kfree(audio);
twl4030_audio_dev = NULL;
return ret; return ret;
} }
static int __devexit twl4030_audio_remove(struct platform_device *pdev) static int __devexit twl4030_audio_remove(struct platform_device *pdev)
{ {
struct twl4030_audio *audio = platform_get_drvdata(pdev);
mfd_remove_devices(&pdev->dev); mfd_remove_devices(&pdev->dev);
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
kfree(audio);
twl4030_audio_dev = NULL; twl4030_audio_dev = NULL;
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册