diff mbox series

[v2] rtw88: debug: Fix the NULL vs IS_ERR() bug for debugfs_create_file()

Message ID 20230919050651.962694-1-ruanjinjie@huawei.com (mailing list archive)
State Accepted
Commit 74f7957c9b1b95553faaf146a2553e023a9d1720
Delegated to: Kalle Valo
Headers show
Series [v2] rtw88: debug: Fix the NULL vs IS_ERR() bug for debugfs_create_file() | expand

Commit Message

Jinjie Ruan Sept. 19, 2023, 5:06 a.m. UTC
Since debugfs_create_file() return ERR_PTR and never return NULL, so use
IS_ERR() to check it instead of checking NULL.

Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
---
v2:
- Fix typo "Fix Fix" in subject.
- Add Acked-by.
---
 drivers/net/wireless/realtek/rtw88/debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kalle Valo Sept. 20, 2023, 11:16 a.m. UTC | #1
Jinjie Ruan <ruanjinjie@huawei.com> wrote:

> Since debugfs_create_file() return ERR_PTR and never return NULL, so use
> IS_ERR() to check it instead of checking NULL.
> 
> Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>

Patch applied to wireless-next.git, thanks.

74f7957c9b1b wifi: rtw88: debug: Fix the NULL vs IS_ERR() bug for debugfs_create_file()
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c
index f8ba133baff0..35bc37a3c469 100644
--- a/drivers/net/wireless/realtek/rtw88/debug.c
+++ b/drivers/net/wireless/realtek/rtw88/debug.c
@@ -1233,9 +1233,9 @@  static struct rtw_debugfs_priv rtw_debug_priv_dm_cap = {
 #define rtw_debugfs_add_core(name, mode, fopname, parent)		\
 	do {								\
 		rtw_debug_priv_ ##name.rtwdev = rtwdev;			\
-		if (!debugfs_create_file(#name, mode,			\
+		if (IS_ERR(debugfs_create_file(#name, mode,		\
 					 parent, &rtw_debug_priv_ ##name,\
-					 &file_ops_ ##fopname))		\
+					 &file_ops_ ##fopname)))	\
 			pr_debug("Unable to initialize debugfs:%s\n",	\
 			       #name);					\
 	} while (0)