struct gart_client *client, *c;
int err = 0;
- client = devm_kzalloc(gart->dev, sizeof(*c), GFP_KERNEL);
+ client = kzalloc(sizeof(*c), GFP_KERNEL);
if (!client)
return -ENOMEM;
client->dev = dev;
return 0;
fail:
- devm_kfree(gart->dev, client);
+ kfree(client);
spin_unlock(&gart->client_lock);
return err;
}
list_for_each_entry(c, &gart->client, list) {
if (c->dev == dev) {
list_del(&c->list);
- devm_kfree(gart->dev, c);
+ kfree(c);
if (list_empty(&gart->client))
gart->active_domain = NULL;
dev_dbg(gart->dev, "Detached %s\n", dev_name(dev));
return ERR_PTR(-ENXIO);
}
- gart = devm_kzalloc(dev, sizeof(*gart), GFP_KERNEL);
+ gart = kzalloc(sizeof(*gart), GFP_KERNEL);
if (!gart) {
dev_err(dev, "failed to allocate gart_device\n");
return ERR_PTR(-ENOMEM);
ret = iommu_device_sysfs_add(&gart->iommu, dev, NULL, "gart");
if (ret) {
dev_err(dev, "Failed to register IOMMU in sysfs\n");
- return ERR_PTR(ret);
+ goto free_gart;
}
iommu_device_set_ops(&gart->iommu, &gart_iommu_ops);
iommu_device_unregister(&gart->iommu);
remove_sysfs:
iommu_device_sysfs_remove(&gart->iommu);
+free_gart:
+ kfree(gart);
return ERR_PTR(ret);
}