drm/radeon/radeon_fence.c: move a dereference below the NULL test
authorDarren Jenkins <darrenrjenkins@gmail.com>
Wed, 30 Dec 2009 01:20:05 +0000 (12:20 +1100)
committerDave Airlie <airlied@redhat.com>
Thu, 7 Jan 2010 03:54:39 +0000 (13:54 +1000)
If a NULL value is possible, the dereference should only occur after the
NULL test.

Coverity CID: 13334

Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/radeon_fence.c

index 4cdd8b4f75492103f330ae021054af4a74182853..8495d4e32e1890daf1626c1c963c978b969d3e61 100644 (file)
@@ -140,16 +140,15 @@ int radeon_fence_create(struct radeon_device *rdev, struct radeon_fence **fence)
 
 bool radeon_fence_signaled(struct radeon_fence *fence)
 {
-       struct radeon_device *rdev = fence->rdev;
        unsigned long irq_flags;
        bool signaled = false;
 
-       if (rdev->gpu_lockup) {
+       if (!fence)
                return true;
-       }
-       if (fence == NULL) {
+
+       if (fence->rdev->gpu_lockup)
                return true;
-       }
+
        write_lock_irqsave(&fence->rdev->fence_drv.lock, irq_flags);
        signaled = fence->signaled;
        /* if we are shuting down report all fence as signaled */