* [PATCH] mac80211: remove return value check of debugfs_create_dir()
@ 2023-04-19 10:45 Yingsha Xu
2023-04-20 14:55 ` Simon Horman
0 siblings, 1 reply; 2+ messages in thread
From: Yingsha Xu @ 2023-04-19 10:45 UTC (permalink / raw)
To: Johannes Berg, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: Yingsha Xu, linux-wireless, netdev, linux-kernel
Smatch complains that:
debugfs_hw_add() warn: 'statsd' is an error pointer or valid
Debugfs checks are generally not supposed to be checked for errors
and it is not necessary here.
Just delete the dead code.
Signed-off-by: Yingsha Xu <ysxu@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
---
NOTES: The issue is found by static analysis and remains untested.
---
net/mac80211/debugfs.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index dfb9f55e2685..207f772bd8ce 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -673,10 +673,6 @@ 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)
- return;
-
#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
DEBUGFS_STATS_ADD(dot11TransmittedFragmentCount);
DEBUGFS_STATS_ADD(dot11MulticastTransmittedFrameCount);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] mac80211: remove return value check of debugfs_create_dir()
2023-04-19 10:45 [PATCH] mac80211: remove return value check of debugfs_create_dir() Yingsha Xu
@ 2023-04-20 14:55 ` Simon Horman
0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2023-04-20 14:55 UTC (permalink / raw)
To: Yingsha Xu
Cc: Johannes Berg, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-wireless, netdev, linux-kernel
On Wed, Apr 19, 2023 at 06:45:47PM +0800, Yingsha Xu wrote:
> Smatch complains that:
> debugfs_hw_add() warn: 'statsd' is an error pointer or valid
>
> Debugfs checks are generally not supposed to be checked for errors
> and it is not necessary here.
>
> Just delete the dead code.
Perhaps:
As per it's documentation, it's expected that most callers
should ignore errors returned by debugfs_create_dir().
So just delete the unnecessary check.
> Signed-off-by: Yingsha Xu <ysxu@hust.edu.cn>
> Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
In any case, the change looks good to me.
Reviewed-by: Simon Horman <simon.horman@corigine.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-20 14:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-19 10:45 [PATCH] mac80211: remove return value check of debugfs_create_dir() Yingsha Xu
2023-04-20 14:55 ` Simon Horman
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 NNTP newsgroup(s).