summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_sysfs.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@gmail.com>2012-07-06 18:06:42 +0100
committerDave Airlie <airlied@gmail.com>2012-07-16 05:57:03 +1000
commit49099c4991da3c94773f888aea2e9d27b8a7c6d1 (patch)
tree5b9f72eacf9893432cf03699011d8335796003ff /drivers/gpu/drm/drm_sysfs.c
parent12f0e670ff2ae5a59984ffae036ddd739cf10b09 (diff)
downloadop-kernel-dev-49099c4991da3c94773f888aea2e9d27b8a7c6d1.zip
op-kernel-dev-49099c4991da3c94773f888aea2e9d27b8a7c6d1.tar.gz
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>
Diffstat (limited to 'drivers/gpu/drm/drm_sysfs.c')
-rw-r--r--drivers/gpu/drm/drm_sysfs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 45cf1dd..45ac8d6 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -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;
}
/**
@@ -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);
}
OpenPOWER on IntegriCloud