We forget to free drm in all instances of failure, and additionally also
forget to destroy the master client if the other client fails
initialization.

Signed-off-by: Lyude Paul <[email protected]>
Cc: Karol Herbst <[email protected]>
---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 5fdc1fbe2ee5..6c88ff776ff6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -538,11 +538,11 @@ nouveau_drm_load(struct drm_device *dev, unsigned long 
flags)
 
        ret = nouveau_cli_init(drm, "DRM-master", &drm->master);
        if (ret)
-               return ret;
+               goto fail_alloc;
 
        ret = nouveau_cli_init(drm, "DRM", &drm->client);
        if (ret)
-               return ret;
+               goto fail_master;
 
        dev->irq_enabled = true;
 
@@ -607,7 +607,9 @@ nouveau_drm_load(struct drm_device *dev, unsigned long 
flags)
 fail_ttm:
        nouveau_vga_fini(drm);
        nouveau_cli_fini(&drm->client);
+fail_master:
        nouveau_cli_fini(&drm->master);
+fail_alloc:
        kfree(drm);
        return ret;
 }
-- 
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to