From: Russell King <rmk+ker...@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

Reply via email to