Skip to content

Commit

Permalink
drm/radeon/radeon_device.c: move a dereference below a NULL test
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Darren Jenkins authored and Dave Airlie committed Jan 7, 2010
1 parent 3655d54 commit 875c186
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/gpu/drm/radeon/radeon_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 875c186

Please sign in to comment.