Skip to contentSkip to conversation

net: ethernet: mediatek: remove return value check of `mtk_wed_hw_add_debugfs`

PATCH Applied Wang Zhang 2 participants 2 messages Apr 21, 2023 – Apr 23, 2023

Subsystems (4)
lore
Share & tools
lore

Wang Zhang

author
#0 lore raw

PATCH 1/1 net: ethernet: mediatek: remove return value check of `mtk_wed_hw_add_debugfs`

Smatch complains that:
mtk_wed_hw_add_debugfs() warn: 'dir' is an error pointer or valid

Debugfs checks are generally not supposed to be checked for errors and it is not necessary here.

fix it by just deleting the dead code.

---
This issue is found by static analyzer. The patched code has passed Smatch checker, but remains untested on mediatek soc.

---
 drivers/net/ethernet/mediatek/mtk_wed_debugfs.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/mediatek/mtk_wed_debugfs.c +0 -2
index 56f663439721..b244c02c5b51 100644
@@ -252,8 +252,6 @@ void mtk_wed_hw_add_debugfs(struct mtk_wed_hw *hw)
 
 	snprintf(hw->dirname, sizeof(hw->dirname), "wed%d", hw->index);
 	dir = debugfs_create_dir(hw->dirname, NULL);
-	if (!dir)
-		return;
 
 	hw->debugfs_dir = dir;
 	debugfs_create_u32("regidx", 0600, dir, &hw->debugfs_reg);
Signature · 1 line
2.34.1
#1 lore raw
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:

Quoted 9 lines · On Fri, 21 Apr 2023 23:10:09 +0800 you wrote:

Smatch complains that:
mtk_wed_hw_add_debugfs() warn: 'dir' is an error pointer or valid

Debugfs checks are generally not supposed to be checked for errors and it is not necessary here.

fix it by just deleting the dead code.

[...]

Here is the summary with links:
- net: ethernet: mediatek: remove return value check of mtk_wed_hw_add_debugfs

    https://git.kernel.org/netdev/net/c/b148b9abc844

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html