drm: Propagate error from drm_fb_helper_init().
authorChris Wilson <chris@chris-wilson.co.uk>
Sun, 6 Jun 2010 09:50:03 +0000 (10:50 +0100)
committerDave Airlie <airlied@redhat.com>
Mon, 7 Jun 2010 23:32:02 +0000 (09:32 +1000)
The previous commit fixes the problem, these commits make sure we actually
fail properly if it happens again.

I've squashed the commits from Chris since they are all fixing one issue.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/intel_fb.c
drivers/gpu/drm/nouveau/nouveau_fbcon.c
drivers/gpu/drm/radeon/radeon_fb.c

index b2ebf02..59a2bf8 100644 (file)
@@ -1402,19 +1402,19 @@ static int i915_load_modeset_init(struct drm_device *dev,
        /* if we have > 1 VGA cards, then disable the radeon VGA resources */
        ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode);
        if (ret)
        /* if we have > 1 VGA cards, then disable the radeon VGA resources */
        ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode);
        if (ret)
-               goto destroy_ringbuffer;
+               goto cleanup_ringbuffer;
 
        ret = vga_switcheroo_register_client(dev->pdev,
                                             i915_switcheroo_set_state,
                                             i915_switcheroo_can_switch);
        if (ret)
 
        ret = vga_switcheroo_register_client(dev->pdev,
                                             i915_switcheroo_set_state,
                                             i915_switcheroo_can_switch);
        if (ret)
-               goto destroy_ringbuffer;
+               goto cleanup_vga_client;
 
        intel_modeset_init(dev);
 
        ret = drm_irq_install(dev);
        if (ret)
 
        intel_modeset_init(dev);
 
        ret = drm_irq_install(dev);
        if (ret)
-               goto destroy_ringbuffer;
+               goto cleanup_vga_switcheroo;
 
        /* Always safe in the mode setting case. */
        /* FIXME: do pre/post-mode set stuff in core KMS code */
 
        /* Always safe in the mode setting case. */
        /* FIXME: do pre/post-mode set stuff in core KMS code */
@@ -1426,11 +1426,20 @@ static int i915_load_modeset_init(struct drm_device *dev,
 
        I915_WRITE(INSTPM, (1 << 5) | (1 << 21));
 
 
        I915_WRITE(INSTPM, (1 << 5) | (1 << 21));
 
-       intel_fbdev_init(dev);
+       ret = intel_fbdev_init(dev);
+       if (ret)
+               goto cleanup_irq;
+
        drm_kms_helper_poll_init(dev);
        return 0;
 
        drm_kms_helper_poll_init(dev);
        return 0;
 
-destroy_ringbuffer:
+cleanup_irq:
+       drm_irq_uninstall(dev);
+cleanup_vga_switcheroo:
+       vga_switcheroo_unregister_client(dev->pdev);
+cleanup_vga_client:
+       vga_client_register(dev->pdev, NULL, NULL, NULL);
+cleanup_ringbuffer:
        mutex_lock(&dev->struct_mutex);
        i915_gem_cleanup_ringbuffer(dev);
        mutex_unlock(&dev->struct_mutex);
        mutex_lock(&dev->struct_mutex);
        i915_gem_cleanup_ringbuffer(dev);
        mutex_unlock(&dev->struct_mutex);
index dfbb0c6..c3c5052 100644 (file)
@@ -245,6 +245,7 @@ int intel_fbdev_init(struct drm_device *dev)
 {
        struct intel_fbdev *ifbdev;
        drm_i915_private_t *dev_priv = dev->dev_private;
 {
        struct intel_fbdev *ifbdev;
        drm_i915_private_t *dev_priv = dev->dev_private;
+       int ret;
 
        ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL);
        if (!ifbdev)
 
        ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL);
        if (!ifbdev)
@@ -253,8 +254,13 @@ int intel_fbdev_init(struct drm_device *dev)
        dev_priv->fbdev = ifbdev;
        ifbdev->helper.funcs = &intel_fb_helper_funcs;
 
        dev_priv->fbdev = ifbdev;
        ifbdev->helper.funcs = &intel_fb_helper_funcs;
 
-       drm_fb_helper_init(dev, &ifbdev->helper, dev_priv->num_pipe,
-                          INTELFB_CONN_LIMIT);
+       ret = drm_fb_helper_init(dev, &ifbdev->helper,
+                                dev_priv->num_pipe,
+                                INTELFB_CONN_LIMIT);
+       if (ret) {
+               kfree(ifbdev);
+               return ret;
+       }
 
        drm_fb_helper_single_add_all_connectors(&ifbdev->helper);
        drm_fb_helper_initial_config(&ifbdev->helper, 32);
 
        drm_fb_helper_single_add_all_connectors(&ifbdev->helper);
        drm_fb_helper_initial_config(&ifbdev->helper, 32);
index fd4a2df..c9a4a0d 100644 (file)
@@ -377,6 +377,7 @@ int nouveau_fbcon_init(struct drm_device *dev)
 {
        struct drm_nouveau_private *dev_priv = dev->dev_private;
        struct nouveau_fbdev *nfbdev;
 {
        struct drm_nouveau_private *dev_priv = dev->dev_private;
        struct nouveau_fbdev *nfbdev;
+       int ret;
 
        nfbdev = kzalloc(sizeof(struct nouveau_fbdev), GFP_KERNEL);
        if (!nfbdev)
 
        nfbdev = kzalloc(sizeof(struct nouveau_fbdev), GFP_KERNEL);
        if (!nfbdev)
@@ -386,7 +387,12 @@ int nouveau_fbcon_init(struct drm_device *dev)
        dev_priv->nfbdev = nfbdev;
        nfbdev->helper.funcs = &nouveau_fbcon_helper_funcs;
 
        dev_priv->nfbdev = nfbdev;
        nfbdev->helper.funcs = &nouveau_fbcon_helper_funcs;
 
-       drm_fb_helper_init(dev, &nfbdev->helper, 2, 4);
+       ret = drm_fb_helper_init(dev, &nfbdev->helper, 2, 4);
+       if (ret) {
+               kfree(nfbdev);
+               return ret;
+       }
+
        drm_fb_helper_single_add_all_connectors(&nfbdev->helper);
        drm_fb_helper_initial_config(&nfbdev->helper, 32);
        return 0;
        drm_fb_helper_single_add_all_connectors(&nfbdev->helper);
        drm_fb_helper_initial_config(&nfbdev->helper, 32);
        return 0;
index e192acf..dc1634b 100644 (file)
@@ -363,6 +363,7 @@ int radeon_fbdev_init(struct radeon_device *rdev)
 {
        struct radeon_fbdev *rfbdev;
        int bpp_sel = 32;
 {
        struct radeon_fbdev *rfbdev;
        int bpp_sel = 32;
+       int ret;
 
        /* select 8 bpp console on RN50 or 16MB cards */
        if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024))
 
        /* select 8 bpp console on RN50 or 16MB cards */
        if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024))
@@ -376,9 +377,14 @@ int radeon_fbdev_init(struct radeon_device *rdev)
        rdev->mode_info.rfbdev = rfbdev;
        rfbdev->helper.funcs = &radeon_fb_helper_funcs;
 
        rdev->mode_info.rfbdev = rfbdev;
        rfbdev->helper.funcs = &radeon_fb_helper_funcs;
 
-       drm_fb_helper_init(rdev->ddev, &rfbdev->helper,
-                          rdev->num_crtc,
-                          RADEONFB_CONN_LIMIT);
+       ret = drm_fb_helper_init(rdev->ddev, &rfbdev->helper,
+                                rdev->num_crtc,
+                                RADEONFB_CONN_LIMIT);
+       if (ret) {
+               kfree(rfbdev);
+               return ret;
+       }
+
        drm_fb_helper_single_add_all_connectors(&rfbdev->helper);
        drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel);
        return 0;
        drm_fb_helper_single_add_all_connectors(&rfbdev->helper);
        drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel);
        return 0;