[Intel-gfx] [RFC 2/3] drm: Register drmfs filesystem from drm init

Chris Wilson chris at chris-wilson.co.uk
Thu Dec 1 08:15:15 UTC 2016


On Thu, Dec 01, 2016 at 12:32:32PM +0530, swati.dhingra at intel.com wrote:
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 84fcfcb..ead360bd 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -688,6 +688,14 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
>  {
>  	int ret;
>  
> +#ifdef CONFIG_DRMFS

Rule of thumb: avoid #ifdeffry in the body of the code, use headers to
hide conditional compilation.

> +	dev->driver->drmfs_root = drmfs_create_dir(dev->driver->name, NULL);
> +	if (IS_ERR(dev->driver->drmfs_root)) {
> +		DRM_ERROR("Failed to get drmfs root dentry\n");
> +		return PTR_ERR(dev->driver->drmfs_root);
> +	}

Considering use of drmfs is optional, should an error here prevent the
driver from loading?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list