Skip to contentSkip to conversation

regulator: mc13783: Convert to devm_kzalloc()

PATCH Applied Fabio Estevam 2 participants 6 messages Dec 29, 2011 – Dec 30, 2011 1 message not in the archive Voltage and current regulator framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 regulator: mc13783: Convert to devm_kzalloc()

Convert mc13783-regulator driver to use devm_kzalloc().

---
 drivers/regulator/mc13783-regulator.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/regulator/mc13783-regulator.c +1 -4
index 8479082..04e1915 100644
@@ -344,7 +344,7 @@ static int __devinit mc13783_regulator_probe(struct platform_device *pdev)
 
 	dev_dbg(&pdev->dev, "%s id %d\n", __func__, pdev->id);
 
-	priv = kzalloc(sizeof(*priv) +
+	priv = devm_kzalloc(&pdev->dev, sizeof(*priv) +
 			pdata->num_regulators * sizeof(priv->regulators[0]),
 			GFP_KERNEL);
 	if (!priv)
@@ -374,8 +374,6 @@ err:
 	while (--i >= 0)
 		regulator_unregister(priv->regulators[i]);
 
-	kfree(priv);
-
 	return ret;
 }
 
@@ -391,7 +389,6 @@ static int __devexit mc13783_regulator_remove(struct platform_device *pdev)
 	for (i = 0; i < pdata->num_regulators; i++)
 		regulator_unregister(priv->regulators[i]);
 
-	kfree(priv);
 	return 0;
 }
 
Signature · 1 line
1.7.1
#1 lore raw

PATCH 2/2 regulator: mc13892: Convert to devm_kzalloc()

Convert mc13892-regulator driver to use devm_kzalloc().

---
 drivers/regulator/mc13892-regulator.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/regulator/mc13892-regulator.c +1 -3
index 023d17d..dd389dd 100644
@@ -531,7 +531,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev)
 	int i, ret;
 	u32 val;
 
-	priv = kzalloc(sizeof(*priv) +
+	priv = devm_kzalloc(&pdev->dev, sizeof(*priv) +
 		pdata->num_regulators * sizeof(priv->regulators[0]),
 		GFP_KERNEL);
 	if (!priv)
@@ -592,7 +592,6 @@ err:
 
 err_free:
 	mc13xxx_unlock(mc13892);
-	kfree(priv);
 
 	return ret;
 }
@@ -609,7 +608,6 @@ static int __devexit mc13892_regulator_remove(struct platform_device *pdev)
 	for (i = 0; i < pdata->num_regulators; i++)
 		regulator_unregister(priv->regulators[i]);
 
-	kfree(priv);
 	return 0;
 }
 
Signature · 1 line
1.7.1
#2 lore raw

Re: [PATCH 2/2] regulator: mc13892: Convert to devm_kzalloc()

Quoted 3 lines · Fabio Estevam

Convert mc13892-regulator driver to use devm_kzalloc().

This one doesn't apply against current -next, please recheck.

A message that is not in the archive (sent off-list or not yet received): 1325174163-27955-2-git-send-email-festevam@gmail .com

#5 lore raw

PATCH v2 2/2 regulator: mc13892: Convert to devm_kzalloc()

Convert mc13892-regulator driver to use devm_kzalloc().

---
Changes since v1:
- Rebased against latest linux-next

 drivers/regulator/mc13892-regulator.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/regulator/mc13892-regulator.c +1 -3
index 46bfa4a..e8cfc99 100644
@@ -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;
 }
 
Signature · 1 line
1.7.1
Applied
#6 lore raw

Re: [PATCH v2 2/2] regulator: mc13892: Convert to devm_kzalloc()

Quoted 3 lines · Fabio Estevam

Convert mc13892-regulator driver to use devm_kzalloc().

Applied, thanks.