[PATCH 4.19 035/148] wifi: mwifiex: debugfs: Drop unnecessary error check for debugfs_create_dir()

Sasha Levin posted 148 patches 1 year, 8 months ago
[PATCH 4.19 035/148] wifi: mwifiex: debugfs: Drop unnecessary error check for debugfs_create_dir()
Posted by Sasha Levin 1 year, 8 months ago
From: Jinjie Ruan <ruanjinjie@huawei.com>

[ Upstream commit 50180c7f8e3de7c2d87f619131776598fcb1478d ]

debugfs_create_dir() returns ERR_PTR and never return NULL.

As Russell suggested, this patch removes the error checking for
debugfs_create_dir(). This is because the DebugFS kernel API is developed
in a way that the caller can safely ignore the errors that occur during
the creation of DebugFS nodes. The debugfs APIs have a IS_ERR() judge in
start_creating() which can handle it gracefully. So these checks are
unnecessary.

Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex driver")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Suggested-by: Russell King (Oracle) <linux@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20230903030216.1509013-3-ruanjinjie@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/wireless/marvell/mwifiex/debugfs.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/debugfs.c b/drivers/net/wireless/marvell/mwifiex/debugfs.c
index 0f62da50e11a2..63af04202d75f 100644
--- a/drivers/net/wireless/marvell/mwifiex/debugfs.c
+++ b/drivers/net/wireless/marvell/mwifiex/debugfs.c
@@ -977,9 +977,6 @@ mwifiex_dev_debugfs_init(struct mwifiex_private *priv)
 	priv->dfs_dev_dir = debugfs_create_dir(priv->netdev->name,
 					       mwifiex_dfs_dir);
 
-	if (!priv->dfs_dev_dir)
-		return;
-
 	MWIFIEX_DFS_ADD_FILE(info);
 	MWIFIEX_DFS_ADD_FILE(debug);
 	MWIFIEX_DFS_ADD_FILE(getlog);
-- 
2.43.0
Re: [PATCH 4.19 035/148] wifi: mwifiex: debugfs: Drop unnecessary error check for debugfs_create_dir()
Posted by Pavel Machek 1 year, 8 months ago
Hi!

> From: Jinjie Ruan <ruanjinjie@huawei.com>
> 
> [ Upstream commit 50180c7f8e3de7c2d87f619131776598fcb1478d ]
> 
> debugfs_create_dir() returns ERR_PTR and never return NULL.
> 
> As Russell suggested, this patch removes the error checking for
> debugfs_create_dir(). This is because the DebugFS kernel API is developed
> in a way that the caller can safely ignore the errors that occur during
> the creation of DebugFS nodes. The debugfs APIs have a IS_ERR() judge in
> start_creating() which can handle it gracefully. So these checks are
> unnecessary.

Additional error handling does not break anything.

This does not fix a bug, and thus does not belong into stable.

Best regards,
								Pavel
								
> +++ b/drivers/net/wireless/marvell/mwifiex/debugfs.c
> @@ -977,9 +977,6 @@ mwifiex_dev_debugfs_init(struct mwifiex_private *priv)
>  	priv->dfs_dev_dir = debugfs_create_dir(priv->netdev->name,
>  					       mwifiex_dfs_dir);
>  
> -	if (!priv->dfs_dev_dir)
> -		return;
> -
>  	MWIFIEX_DFS_ADD_FILE(info);
>  	MWIFIEX_DFS_ADD_FILE(debug);
>  	MWIFIEX_DFS_ADD_FILE(getlog);

-- 
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany