diff mbox series

[2/5] drm/i915: check dri root before debugfs init

Message ID 20211008091704.27094-2-nirmoy.das@amd.com (mailing list archive)
State New, archived
Headers show
Series [1/5] dri: cleanup debugfs error handling | expand

Commit Message

Das, Nirmoy Oct. 8, 2021, 9:17 a.m. UTC
Return early if dri minor root dentry is NULL.

CC: Zhenyu Wang <zhenyuw@linux.intel.com>
CC: Zhi Wang <zhi.a.wang@intel.com>
CC: Jani Nikula <jani.nikula@linux.intel.com>
CC: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
CC: Rodrigo Vivi <rodrigo.vivi@intel.com>
CC: David Airlie <airlied@linux.ie>
CC: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
---
 drivers/gpu/drm/i915/gvt/debugfs.c  | 3 +++
 drivers/gpu/drm/i915/i915_debugfs.c | 3 +++
 2 files changed, 6 insertions(+)

--
2.32.0

Comments

Wang, Zhi A Oct. 12, 2021, 9:59 a.m. UTC | #1
On 10/8/21 9:17 AM, Nirmoy Das wrote:
> Return early if dri minor root dentry is NULL.
> 
> CC: Zhenyu Wang <zhenyuw@linux.intel.com>
> CC: Zhi Wang <zhi.a.wang@intel.com>
> CC: Jani Nikula <jani.nikula@linux.intel.com>
> CC: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> CC: Rodrigo Vivi <rodrigo.vivi@intel.com>
> CC: David Airlie <airlied@linux.ie>
> CC: Daniel Vetter <daniel@ffwll.ch>
> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
> ---
>   drivers/gpu/drm/i915/gvt/debugfs.c  | 3 +++
>   drivers/gpu/drm/i915/i915_debugfs.c | 3 +++
>   2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/debugfs.c b/drivers/gpu/drm/i915/gvt/debugfs.c
> index 9f1c209d9251..2d47acaa03ee 100644
> --- a/drivers/gpu/drm/i915/gvt/debugfs.c
> +++ b/drivers/gpu/drm/i915/gvt/debugfs.c
> @@ -187,6 +187,9 @@ void intel_gvt_debugfs_init(struct intel_gvt *gvt)
>   {
>   	struct drm_minor *minor = gvt->gt->i915->drm.primary;
> 
> +	if (!minor->debugfs_root)
> +		return;
> +
>   	gvt->debugfs_root = debugfs_create_dir("gvt", minor->debugfs_root);
> 
>   	debugfs_create_ulong("num_tracked_mmio", 0444, gvt->debugfs_root,
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 44969f5dde50..d572b686edeb 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1012,6 +1012,9 @@ void i915_debugfs_register(struct drm_i915_private *dev_priv)
>   	struct drm_minor *minor = dev_priv->drm.primary;
>   	int i;
> 
> +	if (!minor->debugfs_root)
> +		return;
> +
>   	i915_debugfs_params(dev_priv);
> 
>   	debugfs_create_file("i915_forcewake_user", S_IRUSR, minor->debugfs_root,
> --
> 2.32.0
> 
Thanks for the patch. queued.
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com>
Das, Nirmoy Oct. 12, 2021, 10:19 a.m. UTC | #2
Hi Zhi,


Please discard this patch,  review 
https://patchwork.freedesktop.org/patch/458554/?series=95690&rev=1 instead.

minor->debugfs_root wont be NULl as we save debugfs_create_dir()'s return value in that.

Regards,
Nirmoy

On 10/12/2021 11:59 AM, Wang, Zhi A wrote:
> On 10/8/21 9:17 AM, Nirmoy Das wrote:
>> Return early if dri minor root dentry is NULL.
>>
>> CC: Zhenyu Wang <zhenyuw@linux.intel.com>
>> CC: Zhi Wang <zhi.a.wang@intel.com>
>> CC: Jani Nikula <jani.nikula@linux.intel.com>
>> CC: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>> CC: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> CC: David Airlie <airlied@linux.ie>
>> CC: Daniel Vetter <daniel@ffwll.ch>
>> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
>> ---
>>    drivers/gpu/drm/i915/gvt/debugfs.c  | 3 +++
>>    drivers/gpu/drm/i915/i915_debugfs.c | 3 +++
>>    2 files changed, 6 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/gvt/debugfs.c b/drivers/gpu/drm/i915/gvt/debugfs.c
>> index 9f1c209d9251..2d47acaa03ee 100644
>> --- a/drivers/gpu/drm/i915/gvt/debugfs.c
>> +++ b/drivers/gpu/drm/i915/gvt/debugfs.c
>> @@ -187,6 +187,9 @@ void intel_gvt_debugfs_init(struct intel_gvt *gvt)
>>    {
>>    	struct drm_minor *minor = gvt->gt->i915->drm.primary;
>>
>> +	if (!minor->debugfs_root)
>> +		return;
>> +
>>    	gvt->debugfs_root = debugfs_create_dir("gvt", minor->debugfs_root);
>>
>>    	debugfs_create_ulong("num_tracked_mmio", 0444, gvt->debugfs_root,
>> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
>> index 44969f5dde50..d572b686edeb 100644
>> --- a/drivers/gpu/drm/i915/i915_debugfs.c
>> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
>> @@ -1012,6 +1012,9 @@ void i915_debugfs_register(struct drm_i915_private *dev_priv)
>>    	struct drm_minor *minor = dev_priv->drm.primary;
>>    	int i;
>>
>> +	if (!minor->debugfs_root)
>> +		return;
>> +
>>    	i915_debugfs_params(dev_priv);
>>
>>    	debugfs_create_file("i915_forcewake_user", S_IRUSR, minor->debugfs_root,
>> --
>> 2.32.0
>>
> Thanks for the patch. queued.
> Reviewed-by: Zhi Wang <zhi.a.wang@intel.com>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gvt/debugfs.c b/drivers/gpu/drm/i915/gvt/debugfs.c
index 9f1c209d9251..2d47acaa03ee 100644
--- a/drivers/gpu/drm/i915/gvt/debugfs.c
+++ b/drivers/gpu/drm/i915/gvt/debugfs.c
@@ -187,6 +187,9 @@  void intel_gvt_debugfs_init(struct intel_gvt *gvt)
 {
 	struct drm_minor *minor = gvt->gt->i915->drm.primary;

+	if (!minor->debugfs_root)
+		return;
+
 	gvt->debugfs_root = debugfs_create_dir("gvt", minor->debugfs_root);

 	debugfs_create_ulong("num_tracked_mmio", 0444, gvt->debugfs_root,
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 44969f5dde50..d572b686edeb 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1012,6 +1012,9 @@  void i915_debugfs_register(struct drm_i915_private *dev_priv)
 	struct drm_minor *minor = dev_priv->drm.primary;
 	int i;

+	if (!minor->debugfs_root)
+		return;
+
 	i915_debugfs_params(dev_priv);

 	debugfs_create_file("i915_forcewake_user", S_IRUSR, minor->debugfs_root,