summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDarren Jenkins <darrenrjenkins@gmail.com>2009-12-30 02:18:30 +0100
committerDave Airlie <airlied@redhat.com>2010-01-07 04:56:06 +0100
commit875c186620e017e62b773c93e46af21bb704fe6b (patch)
tree56c7a77d40b9c5f780f636f5e4aa425b31897fd7 /drivers
parentdrm/radeon/radeon_fence.c: move a dereference below the NULL test (diff)
downloadlinux-875c186620e017e62b773c93e46af21bb704fe6b.tar.xz
linux-875c186620e017e62b773c93e46af21bb704fe6b.zip
drm/radeon/radeon_device.c: move a dereference below a NULL test
If a NULL value is possible, the dereference should only occur after the NULL test. Coverity CID: 13335 Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 7c6848096bcd..0c51f8e46613 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -733,16 +733,18 @@ void radeon_device_fini(struct radeon_device *rdev)
*/
int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
{
- struct radeon_device *rdev = dev->dev_private;
+ struct radeon_device *rdev;
struct drm_crtc *crtc;
int r;
- if (dev == NULL || rdev == NULL) {
+ if (dev == NULL || dev->dev_private == NULL) {
return -ENODEV;
}
if (state.event == PM_EVENT_PRETHAW) {
return 0;
}
+ rdev = dev->dev_private;
+
/* unpin the front buffers */
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->fb);