Skip to content

Commit 167d67d

Browse files
digetxjoergroedel
authored andcommitted
iommu/tegra: gart: Don't use managed resources
GART is a part of the Memory Controller driver that is always built-in, hence there is no benefit from the use of managed resources. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 7d849b7 commit 167d67d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/iommu/tegra-gart.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static int gart_iommu_attach_dev(struct iommu_domain *domain,
173173
struct gart_client *client, *c;
174174
int err = 0;
175175

176-
client = devm_kzalloc(gart->dev, sizeof(*c), GFP_KERNEL);
176+
client = kzalloc(sizeof(*c), GFP_KERNEL);
177177
if (!client)
178178
return -ENOMEM;
179179
client->dev = dev;
@@ -199,7 +199,7 @@ static int gart_iommu_attach_dev(struct iommu_domain *domain,
199199
return 0;
200200

201201
fail:
202-
devm_kfree(gart->dev, client);
202+
kfree(client);
203203
spin_unlock(&gart->client_lock);
204204
return err;
205205
}
@@ -214,7 +214,7 @@ static void __gart_iommu_detach_dev(struct iommu_domain *domain,
214214
list_for_each_entry(c, &gart->client, list) {
215215
if (c->dev == dev) {
216216
list_del(&c->list);
217-
devm_kfree(gart->dev, c);
217+
kfree(c);
218218
if (list_empty(&gart->client))
219219
gart->active_domain = NULL;
220220
dev_dbg(gart->dev, "Detached %s\n", dev_name(dev));
@@ -455,7 +455,7 @@ struct gart_device *tegra_gart_probe(struct device *dev, struct tegra_mc *mc)
455455
return ERR_PTR(-ENXIO);
456456
}
457457

458-
gart = devm_kzalloc(dev, sizeof(*gart), GFP_KERNEL);
458+
gart = kzalloc(sizeof(*gart), GFP_KERNEL);
459459
if (!gart) {
460460
dev_err(dev, "failed to allocate gart_device\n");
461461
return ERR_PTR(-ENOMEM);
@@ -464,7 +464,7 @@ struct gart_device *tegra_gart_probe(struct device *dev, struct tegra_mc *mc)
464464
ret = iommu_device_sysfs_add(&gart->iommu, dev, NULL, "gart");
465465
if (ret) {
466466
dev_err(dev, "Failed to register IOMMU in sysfs\n");
467-
return ERR_PTR(ret);
467+
goto free_gart;
468468
}
469469

470470
iommu_device_set_ops(&gart->iommu, &gart_iommu_ops);
@@ -502,6 +502,8 @@ struct gart_device *tegra_gart_probe(struct device *dev, struct tegra_mc *mc)
502502
iommu_device_unregister(&gart->iommu);
503503
remove_sysfs:
504504
iommu_device_sysfs_remove(&gart->iommu);
505+
free_gart:
506+
kfree(gart);
505507

506508
return ERR_PTR(ret);
507509
}

0 commit comments

Comments
 (0)