if (IS_ERR(clk))
return PTR_ERR(clk);
- pcdev = kzalloc(sizeof(*pcdev) + resource_size(res), GFP_KERNEL);
- if (!pcdev) {
- dev_err(&pdev->dev, "Could not allocate pcdev\n");
+ pcdev = devm_kzalloc(&pdev->dev, sizeof(*pcdev) + resource_size(res),
+ GFP_KERNEL);
+ if (!pcdev)
return -ENOMEM;
- }
pcdev->res = res;
pcdev->clk = clk;
/*
* Request the region.
*/
- if (!request_mem_region(res->start, resource_size(res), DRIVER_NAME)) {
- err = -EBUSY;
- goto exit_kfree;
- }
+ if (!request_mem_region(res->start, resource_size(res), DRIVER_NAME))
+ return -EBUSY;
base = ioremap(res->start, resource_size(res));
if (!base) {
iounmap(base);
exit_release:
release_mem_region(res->start, resource_size(res));
-exit_kfree:
- kfree(pcdev);
exit:
return err;
}
res = pcdev->res;
release_mem_region(res->start, resource_size(res));
- kfree(pcdev);
-
dev_info(&pdev->dev, "OMAP1 Camera Interface driver unloaded\n");
return 0;