ntb.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Wang Ming <machel@vivo.com>
To: Jon Mason <jdmason@kudzu.us>, Dave Jiang <dave.jiang@intel.com>,
	Allen Hubbe <allenbh@gmail.com>,
	Serge Semin <fancer.lancer@gmail.com>,
	Dan Carpenter <error27@gmail.com>,
	Jiasheng Jiang <jiasheng@iscas.ac.cn>,
	Wang Ming <machel@vivo.com>,
	ntb@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: opensource.kernel@vivo.com
Subject: [PATCH v2] ntb:Fix an NULL vs IS_ERR() bug for debugfs_create_dir() in tool_setup_dbgfs()
Date: Wed, 12 Jul 2023 20:39:59 +0800	[thread overview]
Message-ID: <20230712124035.7981-1-machel@vivo.com> (raw)

The debugfs_create_dir() function returns error pointers.
It never returns NULL. Most incorrect error checks were fixed,
but the one in tool_setup_dbgfs() was forgotten.

Fix the remaining error check.

Signed-off-by: Wang Ming <machel@vivo.com>
---
 drivers/ntb/test/ntb_tool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ntb/test/ntb_tool.c b/drivers/ntb/test/ntb_tool.c
index eeeb4b1c97d2..4fa69ea4331d 100644
--- a/drivers/ntb/test/ntb_tool.c
+++ b/drivers/ntb/test/ntb_tool.c
@@ -1495,7 +1495,7 @@ static void tool_setup_dbgfs(struct tool_ctx *tc)
 
 	tc->dbgfs_dir = debugfs_create_dir(dev_name(&tc->ntb->dev),
 					   tool_dbgfs_topdir);
-	if (!tc->dbgfs_dir)
+	if (IS_ERR(tc->dbgfs_dir))
 		return;
 
 	debugfs_create_file("port", 0600, tc->dbgfs_dir,
-- 
2.25.1


             reply	other threads:[~2023-07-12 12:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12 12:39 Wang Ming [this message]
2023-07-12 13:50 ` [PATCH v2] ntb:Fix an NULL vs IS_ERR() bug for debugfs_create_dir() in tool_setup_dbgfs() Dan Carpenter
2023-07-13  2:13   ` 回复: " 王明-软件底层技术部
2023-07-13  6:00     ` Dan Carpenter
2023-07-13  7:23       ` 回复: " 王明-软件底层技术部

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=20230712124035.7981-1-machel@vivo.com \
    --to=machel@vivo.com \
    --cc=allenbh@gmail.com \
    --cc=dave.jiang@intel.com \
    --cc=error27@gmail.com \
    --cc=fancer.lancer@gmail.com \
    --cc=jdmason@kudzu.us \
    --cc=jiasheng@iscas.ac.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntb@lists.linux.dev \
    --cc=opensource.kernel@vivo.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).