Initialize max_vblank_count earlier.
authorHasso Tepper <hasso@estpak.ee>
Thu, 25 Jun 2009 18:44:41 +0000 (21:44 +0300)
committerHasso Tepper <hasso@estpak.ee>
Thu, 25 Jun 2009 21:28:17 +0000 (00:28 +0300)
Small cleanup of the error paths while I'm here.

Obtained-from: FreeBSD

sys/dev/drm/radeon_cp.c
sys/dev/drm/radeon_irq.c

index 1ef3f55..b05e72b 100644 (file)
@@ -2071,16 +2071,22 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags)
                         drm_get_resource_len(dev, 2), _DRM_REGISTERS,
                         _DRM_READ_ONLY | _DRM_DRIVER, &dev_priv->mmio);
        if (ret != 0)
-               return ret;
+               goto error;
 
        ret = drm_vblank_init(dev, 2);
-       if (ret) {
-               radeon_driver_unload(dev);
-               return ret;
-       }
+       if (ret != 0)
+               goto error;
+
+       dev->max_vblank_count = 0x001fffff;
 
        DRM_DEBUG("%s card detected\n",
-                 ((dev_priv->flags & RADEON_IS_AGP) ? "AGP" : (((dev_priv->flags & RADEON_IS_PCIE) ? "PCIE" : "PCI"))));
+                 ((dev_priv->flags & RADEON_IS_AGP) ? "AGP" :
+                   (((dev_priv->flags & RADEON_IS_PCIE) ? "PCIE" : "PCI"))));
+
+       return ret;
+
+error:
+       radeon_driver_unload(dev);
        return ret;
 }
 
index 9d4841f..9ff3bfd 100644 (file)
@@ -377,8 +377,6 @@ int radeon_driver_irq_postinstall(struct drm_device * dev)
        atomic_set(&dev_priv->swi_emitted, 0);
        DRM_INIT_WAITQUEUE(&dev_priv->swi_queue);
 
-       dev->max_vblank_count = 0x001fffff;
-
        radeon_irq_set_state(dev, RADEON_SW_INT_ENABLE, 1);
 
        return 0;