drm/radeon/kms: release agp on error.
authorDave Airlie <airlied@redhat.com>
Mon, 1 Feb 2010 01:22:10 +0000 (11:22 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 1 Feb 2010 01:22:10 +0000 (11:22 +1000)
if we get an error, release the AGP if we've acquired it already.

Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/radeon_agp.c

index b634d984766705b65e35a12be4cb7423cd9ac4c2..c0681a5556dc96bc0bbbeec86774c3d23098ad35 100644 (file)
@@ -144,11 +144,13 @@ int radeon_agp_init(struct radeon_device *rdev)
 
        ret = drm_agp_info(rdev->ddev, &info);
        if (ret) {
+               drm_agp_release(rdev->ddev);
                DRM_ERROR("Unable to get AGP info: %d\n", ret);
                return ret;
        }
 
        if (rdev->ddev->agp->agp_info.aper_size < 32) {
+               drm_agp_release(rdev->ddev);
                dev_warn(rdev->dev, "AGP aperture too small (%zuM) "
                        "need at least 32M, disabling AGP\n",
                        rdev->ddev->agp->agp_info.aper_size);
@@ -229,6 +231,7 @@ int radeon_agp_init(struct radeon_device *rdev)
        ret = drm_agp_enable(rdev->ddev, mode);
        if (ret) {
                DRM_ERROR("Unable to enable AGP (mode = 0x%lx)\n", mode.mode);
+               drm_agp_release(rdev->ddev);
                return ret;
        }