Skip to contentSkip to conversation

drivers: power: Replace use of devm_kzalloc instead of kzalloc

PATCH In review Vatika Harlalka 2 participants 3 messages Mar 12, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: power: Replace use of devm_kzalloc instead of kzalloc

This patch moves shared private data kzalloc to managed devm_kzalloc and so kfree is not required.

---
 drivers/power/intel_mid_battery.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/power/intel_mid_battery.c +1 -2
index de3f39e..8282e14 100644
@@ -656,7 +656,7 @@ static int probe(int irq, struct device *dev)
 
 	dev_dbg(dev, "pmic-battery: found pmic battery device\n");
 
-	pbi = kzalloc(sizeof(*pbi), GFP_KERNEL);
+	pbi = devm_kzalloc(dev, sizeof(*pbi), GFP_KERNEL);
 	if (!pbi) {
 		dev_err(dev, "%s(): memory allocation failed\n",
 								__func__);
@@ -734,7 +734,6 @@ power_reg_failed:
 requestirq_failed:
 	destroy_workqueue(pbi->monitor_wqueue);
 wqueue_failed:
-	kfree(pbi);
 
 	return retval;
 }
Signature · 1 line
1.9.1
#1 lore raw
Quoted 6 lines · Vatika Harlalka

This patch moves shared private data kzalloc to managed devm_kzalloc and so kfree is not required.

---
 drivers/power/intel_mid_battery.c | 3 +--

I can not accept patches outside of drivers/staging/ for any outreachy application submissions, sorry. There's nothing I can do with this at this time.

Please stick with drivers/staging/* for now.

thanks,

greg k-h