[PATCH 10/48] staging: etnaviv: fix missing error cleanups in etnaviv_load()

Lucas Stach l.stach at pengutronix.de
Fri Sep 25 04:57:22 PDT 2015


From: Russell King <rmk+kernel at arm.linux.org.uk>

The only failure which etnaviv_load() implemented was for kzalloc().
Other failures (alloc_ordered_workqueue(), component_bind_all()) were
not implemented.  Add these.

Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
---
 drivers/staging/etnaviv/etnaviv_drv.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/etnaviv/etnaviv_drv.c b/drivers/staging/etnaviv/etnaviv_drv.c
index b2ce4a6467ed..8dcd7f19ecff 100644
--- a/drivers/staging/etnaviv/etnaviv_drv.c
+++ b/drivers/staging/etnaviv/etnaviv_drv.c
@@ -128,6 +128,11 @@ static int etnaviv_load(struct drm_device *dev, unsigned long flags)
 	dev->dev_private = priv;
 
 	priv->wq = alloc_ordered_workqueue("etnaviv", 0);
+	if (!priv->wq) {
+		err = -ENOMEM;
+		goto err_wq;
+	}
+
 	init_waitqueue_head(&priv->fence_event);
 
 	INIT_LIST_HEAD(&priv->inactive_list);
@@ -137,11 +142,18 @@ static int etnaviv_load(struct drm_device *dev, unsigned long flags)
 
 	err = component_bind_all(dev->dev, dev);
 	if (err < 0)
-		return err;
+		goto err_bind;
 
 	load_gpu(dev);
 
 	return 0;
+
+err_bind:
+	flush_workqueue(priv->wq);
+	destroy_workqueue(priv->wq);
+err_wq:
+	kfree(priv);
+	return err;
 }
 
 static int etnaviv_open(struct drm_device *dev, struct drm_file *file)
-- 
2.5.1



More information about the dri-devel mailing list