]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/gpu/host1x/dev.c
gpu: host1x: Free the IOMMU domain when there is no device to attach
[karo-tx-linux.git] / drivers / gpu / host1x / dev.c
index 5c1c711a21af13dd73ea1938ce0ba4d8a6aa579c..7782725141648360cedd89f3363155da5f7c8d9c 100644 (file)
@@ -172,7 +172,7 @@ static int host1x_probe(struct platform_device *pdev)
 
        host->rst = devm_reset_control_get(&pdev->dev, "host1x");
        if (IS_ERR(host->rst)) {
-               err = PTR_ERR(host->clk);
+               err = PTR_ERR(host->rst);
                dev_err(&pdev->dev, "failed to get reset: %d\n", err);
                return err;
        }
@@ -186,8 +186,13 @@ static int host1x_probe(struct platform_device *pdev)
                        return -ENOMEM;
 
                err = iommu_attach_device(host->domain, &pdev->dev);
-               if (err)
+               if (err == -ENODEV) {
+                       iommu_domain_free(host->domain);
+                       host->domain = NULL;
+                       goto skip_iommu;
+               } else if (err) {
                        goto fail_free_domain;
+               }
 
                geometry = &host->domain->geometry;
 
@@ -198,6 +203,7 @@ static int host1x_probe(struct platform_device *pdev)
                host->iova_end = geometry->aperture_end;
        }
 
+skip_iommu:
        err = host1x_channel_list_init(&host->channel_list,
                                       host->info->nb_channels);
        if (err) {