[Intel-gfx] [PATCH 1/3] drm/i915: stop registering if drm_dev_register() fails
Chris Wilson
chris at chris-wilson.co.uk
Tue Nov 24 19:23:20 UTC 2020
Quoting Lucas De Marchi (2020-11-24 19:13:14)
> If drm_dev_register() fails there is no reason to continue registering
> the driver and initializing.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.c | 20 +++++++++++---------
> 1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 320856b665a1..c3fad01ce26f 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -669,17 +669,19 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
> intel_vgpu_register(dev_priv);
>
> /* Reveal our presence to userspace */
> - if (drm_dev_register(dev, 0) == 0) {
> - i915_debugfs_register(dev_priv);
> - if (HAS_DISPLAY(dev_priv))
> - intel_display_debugfs_register(dev_priv);
> - i915_setup_sysfs(dev_priv);
> -
> - /* Depends on sysfs having been initialized */
> - i915_perf_register(dev_priv);
> - } else
> + if (drm_dev_register(dev, 0) != 0) {
> drm_err(&dev_priv->drm,
> "Failed to register driver for userspace access!\n");
> + return;
> + }
s/!= 0//
Ok, we keep the driver loaded to do powersaving if not registered, so
there is some advantage in the face of failure. And there is little
point in trying to register some auxiliary interfaces if the primary
inodes are not exposed.
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris
More information about the Intel-gfx
mailing list