Skip to content

Commit

Permalink
drm: fail gracefully when proc isn't setup.
Browse files Browse the repository at this point in the history
If drm can't find proc it should fail more gracefully, than just
oopsing, this tests drm_class is NULL, and sets it to NULL in the
fail paths.

Reported-by: Fengguang Wu <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
  • Loading branch information
airlied committed Jul 15, 2012
1 parent 12f0e67 commit 49099c4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/gpu/drm/drm_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ void drm_sysfs_destroy(void)
return;
class_remove_file(drm_class, &class_attr_version.attr);
class_destroy(drm_class);
drm_class = NULL;
}

/**
Expand Down Expand Up @@ -554,6 +555,9 @@ void drm_sysfs_device_remove(struct drm_minor *minor)

int drm_class_device_register(struct device *dev)
{
if (!drm_class || IS_ERR(drm_class))
return -ENOENT;

dev->class = drm_class;
return device_register(dev);
}
Expand Down

0 comments on commit 49099c4

Please sign in to comment.