Netdev List
 help / color / mirror / Atom feed
From: yingsha xu <ysxu@hust.edu.cn>
To: Johannes Berg <johannes@sipsolutions.net>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Jiri Benc <jbenc@suse.cz>,
	"John W. Linville" <linville@tuxdriver.com>
Cc: hust-os-kernel-patches@googlegroups.com,
	yingsha xu <ysxu@hust.edu.cn>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] net: mac80211: use IS_ERR to check return value
Date: Sun, 16 Apr 2023 16:30:27 +0800	[thread overview]
Message-ID: <20230416083028.14044-1-ysxu@hust.edu.cn> (raw)

According to the annotation of function debugfs_create_fs, if
an error occurs, ERR_PTR(-ERROR) will be returned instead of
a null pointer or zero value.

Fix it by using IS_ERR().

Fixes: e9f207f0ff90 ("[MAC80211]: Add debugfs attributes.")
Signed-off-by: yingsha xu <ysxu@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
---
 net/mac80211/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index dfb9f55e2685..672bf969ad88 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -674,7 +674,7 @@ void debugfs_hw_add(struct ieee80211_local *local)
 	statsd = debugfs_create_dir("statistics", phyd);
 
 	/* if the dir failed, don't put all the other things into the root! */
-	if (!statsd)
+	if (IS_ERR(statsd))
 		return;
 
 #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
-- 
2.17.1


             reply	other threads:[~2023-04-16  8:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-16  8:30 yingsha xu [this message]
2023-04-18  8:36 ` [PATCH] net: mac80211: use IS_ERR to check return value Johannes Berg
2023-04-19 11:23   ` Dan Carpenter

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=20230416083028.14044-1-ysxu@hust.edu.cn \
    --to=ysxu@hust.edu.cn \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hust-os-kernel-patches@googlegroups.com \
    --cc=jbenc@suse.cz \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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