drm/radeon/kms: r600/r700 don't test ib if ib initialization fails
authorJerome Glisse <jglisse@redhat.com>
Sun, 17 Jan 2010 20:21:56 +0000 (21:21 +0100)
committerDave Airlie <airlied@linux.ie>
Wed, 20 Jan 2010 22:47:01 +0000 (08:47 +1000)
If ib initialization failed don't try to test ib as it will result
in an oops (accessing NULL ib buffer ptr).

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
drivers/gpu/drm/radeon/r600.c
drivers/gpu/drm/radeon/rv770.c

index bb9115bdc3a2f12f4ccb1804145a44c41f638fba..d0bd117a463aeadc472987ab3a41232bc6554ce5 100644 (file)
@@ -2064,13 +2064,14 @@ int r600_init(struct radeon_device *rdev)
        if (rdev->accel_working) {
                r = radeon_ib_pool_init(rdev);
                if (r) {
-                       DRM_ERROR("radeon: failed initializing IB pool (%d).\n", r);
-                       rdev->accel_working = false;
-               }
-               r = r600_ib_test(rdev);
-               if (r) {
-                       DRM_ERROR("radeon: failed testing IB (%d).\n", r);
+                       dev_err(rdev->dev, "IB initialization failed (%d).\n", r);
                        rdev->accel_working = false;
+               } else {
+                       r = r600_ib_test(rdev);
+                       if (r) {
+                               dev_err(rdev->dev, "IB test failed (%d).\n", r);
+                               rdev->accel_working = false;
+                       }
                }
        }
 
index c8cf2bc2b9114ab110efa62f332f038a633106d0..cf8f2b17d627fed533e7cee3b3614963fca65978 100644 (file)
@@ -1075,13 +1075,14 @@ int rv770_init(struct radeon_device *rdev)
        if (rdev->accel_working) {
                r = radeon_ib_pool_init(rdev);
                if (r) {
-                       DRM_ERROR("radeon: failed initializing IB pool (%d).\n", r);
-                       rdev->accel_working = false;
-               }
-               r = r600_ib_test(rdev);
-               if (r) {
-                       DRM_ERROR("radeon: failed testing IB (%d).\n", r);
+                       dev_err(rdev->dev, "IB initialization failed (%d).\n", r);
                        rdev->accel_working = false;
+               } else {
+                       r = r600_ib_test(rdev);
+                       if (r) {
+                               dev_err(rdev->dev, "IB test failed (%d).\n", r);
+                               rdev->accel_working = false;
+                       }
                }
        }
        return 0;