[PATCHv4 1/5] drm/tegra: Fix gr2d initialisation clean up

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



gr2d initialisation clean up had missing steps (i.e. host1x channel
was not released if we could not register gr2d as a host1x client)
that could have lead to weird issues. This patch reworks the
initialisation sequence to do clean up correctly.

Signed-off-by: Arto Merilainen <amerilainen@xxxxxxxxxx>
---
 drivers/gpu/host1x/drm/gr2d.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/host1x/drm/gr2d.c b/drivers/gpu/host1x/drm/gr2d.c
index 27ffcf1..60150ad 100644
--- a/drivers/gpu/host1x/drm/gr2d.c
+++ b/drivers/gpu/host1x/drm/gr2d.c
@@ -282,13 +282,15 @@ static int gr2d_probe(struct platform_device *pdev)
 	}
 
 	gr2d->channel = host1x_channel_request(dev);
-	if (!gr2d->channel)
-		return -ENOMEM;
+	if (!gr2d->channel) {
+		err = -ENOMEM;
+		goto err_channel_request;
+	}
 
 	*syncpts = host1x_syncpt_request(dev, false);
 	if (!(*syncpts)) {
-		host1x_channel_free(gr2d->channel);
-		return -ENOMEM;
+		err = -ENOMEM;
+		goto err_syncpt_request;
 	}
 
 	gr2d->client.ops = &gr2d_client_ops;
@@ -300,7 +302,7 @@ static int gr2d_probe(struct platform_device *pdev)
 	err = host1x_register_client(host1x, &gr2d->client);
 	if (err < 0) {
 		dev_err(dev, "failed to register host1x client: %d\n", err);
-		return err;
+		goto err_register_client;
 	}
 
 	gr2d_init_addr_reg_map(dev, gr2d);
@@ -308,6 +310,15 @@ static int gr2d_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, gr2d);
 
 	return 0;
+
+err_register_client:
+	host1x_syncpt_free(*gr2d->client.syncpts);
+err_syncpt_request:
+	host1x_channel_free(gr2d->channel);
+err_channel_request:
+	clk_disable_unprepare(gr2d->clk);
+
+	return err;
 }
 
 static int __exit gr2d_remove(struct platform_device *pdev)
-- 
1.8.1.5

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux