Commit 875c1866 authored by Darren Jenkins's avatar Darren Jenkins Committed by Dave Airlie

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: default avatarDarren Jenkins <darrenrjenkins@gmail.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 3655d54a
...@@ -733,16 +733,18 @@ void radeon_device_fini(struct radeon_device *rdev) ...@@ -733,16 +733,18 @@ void radeon_device_fini(struct radeon_device *rdev)
*/ */
int radeon_suspend_kms(struct drm_device *dev, pm_message_t state) 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; struct drm_crtc *crtc;
int r; int r;
if (dev == NULL || rdev == NULL) { if (dev == NULL || dev->dev_private == NULL) {
return -ENODEV; return -ENODEV;
} }
if (state.event == PM_EVENT_PRETHAW) { if (state.event == PM_EVENT_PRETHAW) {
return 0; return 0;
} }
rdev = dev->dev_private;
/* unpin the front buffers */ /* unpin the front buffers */
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->fb); struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->fb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment