diff options
author | Dave Airlie <airlied@gmail.com> | 2012-07-06 13:06:42 -0400 |
---|---|---|
committer | Dave Airlie <airlied@gmail.com> | 2012-07-15 15:57:03 -0400 |
commit | 49099c4991da3c94773f888aea2e9d27b8a7c6d1 (patch) | |
tree | 5b9f72eacf9893432cf03699011d8335796003ff | |
parent | 12f0e670ff2ae5a59984ffae036ddd739cf10b09 (diff) |
drm: fail gracefully when proc isn't setup.
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 <fengguang.wu@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/drm_sysfs.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index 45cf1dd3eb9c..45ac8d6c92b7 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c | |||
@@ -134,6 +134,7 @@ void drm_sysfs_destroy(void) | |||
134 | return; | 134 | return; |
135 | class_remove_file(drm_class, &class_attr_version.attr); | 135 | class_remove_file(drm_class, &class_attr_version.attr); |
136 | class_destroy(drm_class); | 136 | class_destroy(drm_class); |
137 | drm_class = NULL; | ||
137 | } | 138 | } |
138 | 139 | ||
139 | /** | 140 | /** |
@@ -554,6 +555,9 @@ void drm_sysfs_device_remove(struct drm_minor *minor) | |||
554 | 555 | ||
555 | int drm_class_device_register(struct device *dev) | 556 | int drm_class_device_register(struct device *dev) |
556 | { | 557 | { |
558 | if (!drm_class || IS_ERR(drm_class)) | ||
559 | return -ENOENT; | ||
560 | |||
557 | dev->class = drm_class; | 561 | dev->class = drm_class; |
558 | return device_register(dev); | 562 | return device_register(dev); |
559 | } | 563 | } |