Skip to contentSkip to conversation

drivers: bus: omap_l3: replacing kzalloc with devm_kzalloc This replace kzalloc with devm_kzalloc and remove kfree

PATCH New abdoulaye berthe 1 participant 1 message May 8, 2014 OMAP2+ support

lore
Share & tools
lore
#0 lore raw

PATCH 809/809 drivers: bus: omap_l3: replacing kzalloc with devm_kzalloc This replace kzalloc with devm_kzalloc and remove kfree

---
 drivers/bus/omap_l3_noc.c | 11 +++--------
 drivers/bus/omap_l3_smx.c | 11 +++--------
 2 files changed, 6 insertions(+), 16 deletions(-)
drivers/bus/omap_l3_noc.c +3 -8
index feeecae..d25d727 100644
@@ -134,7 +134,7 @@ static int omap4_l3_probe(struct platform_device *pdev)
 	struct resource	*res;
 	int ret;
 
-	l3 = kzalloc(sizeof(*l3), GFP_KERNEL);
+	l3 = devm_kzalloc(&pdev->dev, sizeof(*l3), GFP_KERNEL);
 	if (!l3)
 		return -ENOMEM;
 
@@ -142,15 +142,13 @@ static int omap4_l3_probe(struct platform_device *pdev)
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res) {
 		dev_err(&pdev->dev, "couldn't find resource 0\n");
-		ret = -ENODEV;
-		goto err0;
+		return -ENODEV;
 	}
 
 	l3->l3_base[0] = ioremap(res->start, resource_size(res));
 	if (!l3->l3_base[0]) {
 		dev_err(&pdev->dev, "ioremap failed\n");
-		ret = -ENOMEM;
-		goto err0;
+		return -ENOMEM;
 	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
@@ -214,8 +212,6 @@ err2:
 	iounmap(l3->l3_base[1]);
 err1:
 	iounmap(l3->l3_base[0]);
-err0:
-	kfree(l3);
 	return ret;
 }
 
@@ -228,7 +224,6 @@ static int omap4_l3_remove(struct platform_device *pdev)
 	iounmap(l3->l3_base[0]);
 	iounmap(l3->l3_base[1]);
 	iounmap(l3->l3_base[2]);
-	kfree(l3);
 
 	return 0;
 }
drivers/bus/omap_l3_smx.c +3 -8
index acc2164..e062aba 100644
@@ -217,7 +217,7 @@ static int __init omap3_l3_probe(struct platform_device *pdev)
 	struct resource *res;
 	int ret;
 
-	l3 = kzalloc(sizeof(*l3), GFP_KERNEL);
+	l3 = devm_kzalloc(&pdev->dev, sizeof(*l3), GFP_KERNEL);
 	if (!l3)
 		return -ENOMEM;
 
@@ -226,14 +226,12 @@ static int __init omap3_l3_probe(struct platform_device *pdev)
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res) {
 		dev_err(&pdev->dev, "couldn't find resource\n");
-		ret = -ENODEV;
-		goto err0;
+		return -ENODEV;
 	}
 	l3->rt = ioremap(res->start, resource_size(res));
 	if (!l3->rt) {
 		dev_err(&pdev->dev, "ioremap failed\n");
-		ret = -ENOMEM;
-		goto err0;
+		return -ENOMEM;
 	}
 
 	l3->debug_irq = platform_get_irq(pdev, 0);
@@ -260,8 +258,6 @@ err2:
 	free_irq(l3->debug_irq, l3);
 err1:
 	iounmap(l3->rt);
-err0:
-	kfree(l3);
 	return ret;
 }
 
@@ -272,7 +268,6 @@ static int __exit omap3_l3_remove(struct platform_device *pdev)
 	free_irq(l3->app_irq, l3);
 	free_irq(l3->debug_irq, l3);
 	iounmap(l3->rt);
-	kfree(l3);
 
 	return 0;
 }
Signature · 1 line
1.8.3.2