diff mbox

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

Message ID 1443182280-15868-11-git-send-email-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas Stach Sept. 25, 2015, 11:57 a.m. UTC
From: Russell King <rmk+kernel@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@arm.linux.org.uk>
---
 drivers/staging/etnaviv/etnaviv_drv.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
diff mbox

Patch

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)