Skip to content

Commit

Permalink
drivers: bus: omap_l3: Convert to use devm_kzalloc
Browse files Browse the repository at this point in the history
We can remove the kfree() calls from probe and remove.

Signed-off-by: Peter Ujfalusi <[email protected]>
Reviewed-by: Santosh Shilimkar <[email protected]>
Acked-by: Tony Lindgren <[email protected]>
Signed-off-by: Nishanth Menon <[email protected]>
Tested-by: Sekhar Nori <[email protected]>
  • Loading branch information
Peter Ujfalusi authored and nmenon committed May 5, 2014
1 parent 455c6fd commit bae7451
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions drivers/bus/omap_l3_noc.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,23 +134,21 @@ 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;

platform_set_drvdata(pdev, l3);
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);
Expand Down Expand Up @@ -214,8 +212,6 @@ static int omap4_l3_probe(struct platform_device *pdev)
iounmap(l3->l3_base[1]);
err1:
iounmap(l3->l3_base[0]);
err0:
kfree(l3);
return ret;
}

Expand All @@ -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;
}
Expand Down

0 comments on commit bae7451

Please sign in to comment.