drm/nouveau: cleanup after display init failure
authorMarcin Slusarz <marcin.slusarz@gmail.com>
Sun, 15 Apr 2012 12:36:08 +0000 (14:36 +0200)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 24 May 2012 06:31:54 +0000 (16:31 +1000)
Depending on exact point of failure, not cleaning would lead to
BUG_ONs/oopses in various distant places.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_display.c

index b670b0d342339ff869f4ecf973f0fc285c730bd1..980b3e187b72432ad6da7053a55a578797c8dd96 100644 (file)
@@ -325,14 +325,21 @@ nouveau_display_create(struct drm_device *dev)
 
        ret = disp->create(dev);
        if (ret)
-               return ret;
+               goto disp_create_err;
 
        if (dev->mode_config.num_crtc) {
                ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
                if (ret)
-                       return ret;
+                       goto vblank_err;
        }
 
+       return 0;
+
+vblank_err:
+       disp->destroy(dev);
+disp_create_err:
+       drm_kms_helper_poll_fini(dev);
+       drm_mode_config_cleanup(dev);
        return ret;
 }