Commit ba99a0f1 authored by Amitoj Kaur Chawla's avatar Amitoj Kaur Chawla Committed by Greg Kroah-Hartman

staging: media: omap1: Replace kzalloc with devm_kzalloc

Replace kzalloc with devm_kzalloc and consequently remove kfrees in
probe and remove functions of a platform device.

As a result of this change, remove unnecessary out of memory message
and an unnecessary label.
Signed-off-by: default avatarAmitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f90272f4
...@@ -1580,11 +1580,10 @@ static int omap1_cam_probe(struct platform_device *pdev) ...@@ -1580,11 +1580,10 @@ static int omap1_cam_probe(struct platform_device *pdev)
if (IS_ERR(clk)) if (IS_ERR(clk))
return PTR_ERR(clk); return PTR_ERR(clk);
pcdev = kzalloc(sizeof(*pcdev) + resource_size(res), GFP_KERNEL); pcdev = devm_kzalloc(&pdev->dev, sizeof(*pcdev) + resource_size(res),
if (!pcdev) { GFP_KERNEL);
dev_err(&pdev->dev, "Could not allocate pcdev\n"); if (!pcdev)
return -ENOMEM; return -ENOMEM;
}
pcdev->res = res; pcdev->res = res;
pcdev->clk = clk; pcdev->clk = clk;
...@@ -1620,10 +1619,8 @@ static int omap1_cam_probe(struct platform_device *pdev) ...@@ -1620,10 +1619,8 @@ static int omap1_cam_probe(struct platform_device *pdev)
/* /*
* Request the region. * Request the region.
*/ */
if (!request_mem_region(res->start, resource_size(res), DRIVER_NAME)) { if (!request_mem_region(res->start, resource_size(res), DRIVER_NAME))
err = -EBUSY; return -EBUSY;
goto exit_kfree;
}
base = ioremap(res->start, resource_size(res)); base = ioremap(res->start, resource_size(res));
if (!base) { if (!base) {
...@@ -1680,8 +1677,6 @@ static int omap1_cam_probe(struct platform_device *pdev) ...@@ -1680,8 +1677,6 @@ static int omap1_cam_probe(struct platform_device *pdev)
iounmap(base); iounmap(base);
exit_release: exit_release:
release_mem_region(res->start, resource_size(res)); release_mem_region(res->start, resource_size(res));
exit_kfree:
kfree(pcdev);
exit: exit:
return err; return err;
} }
...@@ -1704,8 +1699,6 @@ static int omap1_cam_remove(struct platform_device *pdev) ...@@ -1704,8 +1699,6 @@ static int omap1_cam_remove(struct platform_device *pdev)
res = pcdev->res; res = pcdev->res;
release_mem_region(res->start, resource_size(res)); release_mem_region(res->start, resource_size(res));
kfree(pcdev);
dev_info(&pdev->dev, "OMAP1 Camera Interface driver unloaded\n"); dev_info(&pdev->dev, "OMAP1 Camera Interface driver unloaded\n");
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment