All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Nirmoy Das <nirmoy.das@amd.com>, amd-gfx@lists.freedesktop.org
Cc: shashank.sharma@amd.com
Subject: Re: [PATCH 1/1] drm/amdgpu: ignore -EPERM error from debugfs
Date: Tue, 5 Oct 2021 15:22:59 +0200	[thread overview]
Message-ID: <ab673b77-e8b7-94a4-76f6-588ad9e472f7@amd.com> (raw)
In-Reply-To: <20211005131115.25595-1-nirmoy.das@amd.com>



Am 05.10.21 um 15:11 schrieb Nirmoy Das:
> Debugfs core APIs will throw -EPERM when user disables debugfs
> using CONFIG_DEBUG_FS_ALLOW_NONE or with kernel param. We shouldn't
> see that as an error. Also validate drm root dentry before creating
> amdgpu debugfs files.
>
> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> index 6611b3c7c149..d786072e918b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> @@ -1617,6 +1617,16 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
>   	struct dentry *ent;
>   	int r, i;
>   
> +	if (IS_ERR(root)) {
> +		/* When debugfs is disabled we get -EPERM which is not an
> +		 * error as this is user controllable.
> +		 */

Well setting primary->debugfs_root to an error code is probably not a 
good idea to begin with.

When debugfs is disabled that should most likely be NULL.

Regards,
Christian.

> +		if (PTR_ERR(root) == -EPERM)
> +			return 0;
> +
> +		return PTR_ERR(ent);
> +	}
> +
>   	ent = debugfs_create_file("amdgpu_preempt_ib", 0600, root, adev,
>   				  &fops_ib_preempt);
>   	if (IS_ERR(ent)) {


  reply	other threads:[~2021-10-05 13:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05 13:11 [PATCH 1/1] drm/amdgpu: ignore -EPERM error from debugfs Nirmoy Das
2021-10-05 13:22 ` Christian König [this message]
2021-10-05 13:49   ` Das, Nirmoy
2021-10-05 13:56     ` Lazar, Lijo
2021-10-05 16:45     ` Christian König
2021-10-06  4:51       ` Lazar, Lijo
2021-10-06  6:19         ` Christian König
2021-10-06  6:32           ` Lazar, Lijo
2021-10-06  6:35             ` Christian König
2021-10-06  6:55               ` Lazar, Lijo
2021-10-06  6:59                 ` Christian König
2021-10-06  8:52                   ` Das, Nirmoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ab673b77-e8b7-94a4-76f6-588ad9e472f7@amd.com \
    --to=christian.koenig@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=nirmoy.das@amd.com \
    --cc=shashank.sharma@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.