int ret, i;
struct kobject *kobj;
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
if (!dev)
return -ENOMEM;
if (!res) {
pr_err("no memory region defined\n");
ret = -ENOENT;
- goto err_free_dev;
+ return ret;
}
if (!request_mem_region(res->start, resource_size(res), pdev->name)) {
pr_err("failed to request mem region\n");
ret = -EBUSY;
- goto err_free_dev;
+ return ret;
}
dev->io_base = ioremap(res->start, resource_size(res));
iounmap(dev->io_base);
err_release_mem:
release_mem_region(res->start, resource_size(res));
-err_free_dev:
#endif
- kfree(dev);
return ret;
}
iounmap(dev->io_base);
release_mem_region(res->start, resource_size(res));
#endif
- kfree(dev);
platform_set_drvdata(pdev, NULL);
/*