From: Fabio Estevam Date: Thu, 29 Dec 2011 22:05:00 +0000 (-0200) Subject: regulator: mc13892: Convert to devm_kzalloc() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4fef21eaacb9d739f0120c930c78dac4f6875b9f;p=linux-beck.git regulator: mc13892: Convert to devm_kzalloc() Convert mc13892-regulator driver to use devm_kzalloc(). Signed-off-by: Fabio Estevam Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/mc13892-regulator.c b/drivers/regulator/mc13892-regulator.c index 46bfa4ae2afd..e8cfc99dd8f0 100644 --- a/drivers/regulator/mc13892-regulator.c +++ b/drivers/regulator/mc13892-regulator.c @@ -538,7 +538,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev) if (num_regulators <= 0) return -EINVAL; - priv = kzalloc(sizeof(*priv) + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv) + num_regulators * sizeof(priv->regulators[0]), GFP_KERNEL); if (!priv) @@ -615,7 +615,6 @@ err: err_free: mc13xxx_unlock(mc13892); - kfree(priv); return ret; } @@ -630,7 +629,6 @@ static int __devexit mc13892_regulator_remove(struct platform_device *pdev) for (i = 0; i < priv->num_regulators; i++) regulator_unregister(priv->regulators[i]); - kfree(priv); return 0; }