regulator: mc13892: Convert to devm_kzalloc()

Convert mc13892-regulator driver to use devm_kzalloc().

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Fabio Estevam 2011-12-29 20:05:00 -02:00 коммит произвёл Mark Brown
Родитель cbe10a3674
Коммит 4fef21eaac
1 изменённых файлов: 1 добавлений и 3 удалений

Просмотреть файл

@ -538,7 +538,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev)
if (num_regulators <= 0) if (num_regulators <= 0)
return -EINVAL; return -EINVAL;
priv = kzalloc(sizeof(*priv) + priv = devm_kzalloc(&pdev->dev, sizeof(*priv) +
num_regulators * sizeof(priv->regulators[0]), num_regulators * sizeof(priv->regulators[0]),
GFP_KERNEL); GFP_KERNEL);
if (!priv) if (!priv)
@ -615,7 +615,6 @@ err:
err_free: err_free:
mc13xxx_unlock(mc13892); mc13xxx_unlock(mc13892);
kfree(priv);
return ret; return ret;
} }
@ -630,7 +629,6 @@ static int __devexit mc13892_regulator_remove(struct platform_device *pdev)
for (i = 0; i < priv->num_regulators; i++) for (i = 0; i < priv->num_regulators; i++)
regulator_unregister(priv->regulators[i]); regulator_unregister(priv->regulators[i]);
kfree(priv);
return 0; return 0;
} }