All of lore.kernel.org
 help / color / mirror / Atom feed
From: lnx7586@gregdf.com
To: mikpelinux@gmail.com
Cc: daniel.vetter@ffwll.ch, dri-devel@lists.freedesktop.org,
	jason@jlekstrand.net, linux-kernel@vger.kernel.org,
	Greg Depoire--Ferrer <lnx7586@gregdf.com>,
	Duncan <j.duncan@cox.net>
Subject: [PATCH] drm/ttm: allow debugfs_create_file() to fail in ttm_global_init()
Date: Mon, 16 Aug 2021 16:30:46 +0200	[thread overview]
Message-ID: <20210816143046.3320-1-lnx7586@gregdf.com> (raw)
In-Reply-To: <CAM43=SNDAcS952MZpsiD2Z-WU9Bd0EPv=7Z86i7FGdvDtsSXdQ@mail.gmail.com>

From: Greg Depoire--Ferrer <lnx7586@gregdf.com>

Commit 69de4421bb4c ("drm/ttm: Initialize debugfs from ttm_global_init()")
unintentionally made ttm_global_init() return early with an error when
debugfs_create_file() fails. When CONFIG_DEBUG_FS is disabled,
debugfs_create_file() returns a ENODEV error so the TTM device would fail
to initialize.

Instead of returning early with the error, print it and continue. ENODEV
can be ignored because it just means that CONFIG_DEBUG_FS is disabled.

Fixes: 69de4421bb4c ("drm/ttm: Initialize debugfs from ttm_global_init()")
Reported-by: Mikael Pettersson <mikpelinux@gmail.com>
Reported-by: Duncan <j.duncan@cox.net>
Signed-off-by: Greg Depoire--Ferrer <lnx7586@gregdf.com>
---
Hi, I had this bug as well with the nouveau driver after updating. This
patch fixes it for me.

 drivers/gpu/drm/ttm/ttm_device.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c
index 74e3b460132b..12b73979c798 100644
--- a/drivers/gpu/drm/ttm/ttm_device.c
+++ b/drivers/gpu/drm/ttm/ttm_device.c
@@ -69,6 +69,7 @@ static int ttm_global_init(void)
 	unsigned long num_pages, num_dma32;
 	struct sysinfo si;
 	int ret = 0;
+	int tmp;
 
 	mutex_lock(&ttm_global_mutex);
 	if (++ttm_glob_use_count > 1)
@@ -78,9 +79,9 @@ static int ttm_global_init(void)
 
 	ttm_debugfs_root = debugfs_create_dir("ttm", NULL);
 	if (IS_ERR(ttm_debugfs_root)) {
-		ret = PTR_ERR(ttm_debugfs_root);
-		ttm_debugfs_root = NULL;
-		goto out;
+		tmp = PTR_ERR(ttm_debugfs_root);
+		if (tmp != -ENODEV)
+			pr_err("failed to create debugfs: %d", tmp);
 	}
 
 	/* Limit the number of pages in the pool to about 50% of the total
-- 
2.31.1


  parent reply	other threads:[~2021-08-16 14:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-02 17:16 [BISECTED] 5.14.0-rc4 broke drm/ttm when !CONFIG_DEBUG_FS Mikael Pettersson
2021-08-02 17:16 ` Mikael Pettersson
2021-08-02 18:29 ` Duncan
2021-08-03  6:54   ` Mikael Pettersson
2021-08-03  6:54     ` Mikael Pettersson
2021-08-16 14:30 ` lnx7586 [this message]
2021-08-19 22:38   ` [PATCH] drm/ttm: allow debugfs_create_file() to fail in ttm_global_init() Duncan

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=20210816143046.3320-1-lnx7586@gregdf.com \
    --to=lnx7586@gregdf.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=j.duncan@cox.net \
    --cc=jason@jlekstrand.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikpelinux@gmail.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.