dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Nirmoy Das <nirmoy.das@amd.com>, dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org, Huang Rui <ray.huang@amd.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>
Subject: Re: [PATCH 2/4] drm/ttm: do not set NULL to debugfs dentry
Date: Tue, 12 Oct 2021 09:09:59 +0200	[thread overview]
Message-ID: <f98a7c4d-0d2c-4ae2-fbc2-e3085dfb3e8c@amd.com> (raw)
In-Reply-To: <20211011190607.104618-2-nirmoy.das@amd.com>

Am 11.10.21 um 21:06 schrieb Nirmoy Das:
> For debugfs directory, it is recommended to save the result
> and pass over to next debugfs API for creating debugfs
> files/directories. Error conditions are handled by debugfs APIs.
>
> CC: Christian Koenig <christian.koenig@amd.com>
> CC: Huang Rui <ray.huang@amd.com>
> CC: David Airlie <airlied@linux.ie>
> CC: Daniel Vetter <daniel@ffwll.ch>
>
> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>

Please also add a comment to ttm_debugfs_root that this can also be an 
ERR_PTR and should not be dereferenced.

Apart from that looks good to me.

Christian.

> ---
>   drivers/gpu/drm/ttm/ttm_device.c | 6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c
> index be24bb6cefd0..225ae6b0b4c2 100644
> --- a/drivers/gpu/drm/ttm/ttm_device.c
> +++ b/drivers/gpu/drm/ttm/ttm_device.c
> @@ -77,9 +77,6 @@ static int ttm_global_init(void)
>   	si_meminfo(&si);
>
>   	ttm_debugfs_root = debugfs_create_dir("ttm", NULL);
> -	if (IS_ERR(ttm_debugfs_root)) {
> -		ttm_debugfs_root = NULL;
> -	}
>
>   	/* Limit the number of pages in the pool to about 50% of the total
>   	 * system memory.
> @@ -108,8 +105,7 @@ static int ttm_global_init(void)
>   	debugfs_create_atomic_t("buffer_objects", 0444, ttm_debugfs_root,
>   				&glob->bo_count);
>   out:
> -	if (ret && ttm_debugfs_root)
> -		debugfs_remove(ttm_debugfs_root);
> +	debugfs_remove(ttm_debugfs_root);
>   	if (ret)
>   		--ttm_glob_use_count;
>   	mutex_unlock(&ttm_global_mutex);
> --
> 2.32.0
>


  reply	other threads:[~2021-10-12  7:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11 19:06 [PATCH 1/4] dri: do not check for NULL debugfs dentry Nirmoy Das
2021-10-11 19:06 ` [PATCH 2/4] drm/ttm: do not set NULL to " Nirmoy Das
2021-10-12  7:09   ` Christian König [this message]
2021-10-12  8:49     ` Das, Nirmoy
2021-10-11 19:06 ` [PATCH 3/4] drm/i915/gt: do not check for NULL " Nirmoy Das
2021-10-11 19:06 ` [PATCH 4/4] vgaswitcheroo: " Nirmoy Das
2021-10-11 20:24   ` Lukas Wunner
2021-10-12  6:48     ` Lukas Wunner
2021-10-12  8:57       ` Das, Nirmoy
  -- strict thread matches above, loose matches on Subject: below --
2021-10-13 18:35 [PATCH v2 1/4] dri: " Nirmoy Das
2021-10-13 18:35 ` [PATCH 2/4] drm/ttm: do not set NULL to " Nirmoy Das

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=f98a7c4d-0d2c-4ae2-fbc2-e3085dfb3e8c@amd.com \
    --to=christian.koenig@amd.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=nirmoy.das@amd.com \
    --cc=ray.huang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox