aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/host1x/dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/host1x/dev.c')
-rw-r--r--drivers/gpu/host1x/dev.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index 03db71173f5d..f1d5f76e9c33 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -223,10 +223,14 @@ static int host1x_probe(struct platform_device *pdev)
223 struct iommu_domain_geometry *geometry; 223 struct iommu_domain_geometry *geometry;
224 unsigned long order; 224 unsigned long order;
225 225
226 err = iova_cache_get();
227 if (err < 0)
228 goto put_group;
229
226 host->domain = iommu_domain_alloc(&platform_bus_type); 230 host->domain = iommu_domain_alloc(&platform_bus_type);
227 if (!host->domain) { 231 if (!host->domain) {
228 err = -ENOMEM; 232 err = -ENOMEM;
229 goto put_group; 233 goto put_cache;
230 } 234 }
231 235
232 err = iommu_attach_group(host->domain, host->group); 236 err = iommu_attach_group(host->domain, host->group);
@@ -234,6 +238,7 @@ static int host1x_probe(struct platform_device *pdev)
234 if (err == -ENODEV) { 238 if (err == -ENODEV) {
235 iommu_domain_free(host->domain); 239 iommu_domain_free(host->domain);
236 host->domain = NULL; 240 host->domain = NULL;
241 iova_cache_put();
237 iommu_group_put(host->group); 242 iommu_group_put(host->group);
238 host->group = NULL; 243 host->group = NULL;
239 goto skip_iommu; 244 goto skip_iommu;
@@ -308,6 +313,9 @@ fail_detach_device:
308fail_free_domain: 313fail_free_domain:
309 if (host->domain) 314 if (host->domain)
310 iommu_domain_free(host->domain); 315 iommu_domain_free(host->domain);
316put_cache:
317 if (host->group)
318 iova_cache_put();
311put_group: 319put_group:
312 iommu_group_put(host->group); 320 iommu_group_put(host->group);
313 321
@@ -328,6 +336,7 @@ static int host1x_remove(struct platform_device *pdev)
328 put_iova_domain(&host->iova); 336 put_iova_domain(&host->iova);
329 iommu_detach_group(host->domain, host->group); 337 iommu_detach_group(host->domain, host->group);
330 iommu_domain_free(host->domain); 338 iommu_domain_free(host->domain);
339 iova_cache_put();
331 iommu_group_put(host->group); 340 iommu_group_put(host->group);
332 } 341 }
333 342