Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49099c49 authored by Dave Airlie's avatar Dave Airlie
Browse files

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: default avatarFengguang Wu <fengguang.wu@intel.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 12f0e670
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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);
}