[PATCHv4 1/5] drm/tegra: Fix gr2d initialisation clean up
Arto Merilainen
amerilainen at nvidia.com
Tue Oct 8 08:27:24 CEST 2013
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 at nvidia.com>
---
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
More information about the dri-devel
mailing list