Skip to contentSkip to conversation

drivers: wireless: ath5k: fix parameter check in ath5k_debug_init_device()

PATCH In review Minjie Du 2 participants 3 messages Jul 13, 2023 Atheros ATH5K wireless driver

lore
Share & tools
lore

Minjie Du

author
#0 lore raw

PATCH v2 1/1 drivers: wireless: ath5k: fix parameter check in ath5k_debug_init_device()

Make IS_ERR_OR_NULL() judge the debugfs_create_dir() function return in ath5k_debug_init_device().

---
v1-v2:
use IS_ERR_OR_NULL() instead of IS_ERR()

---
 drivers/net/wireless/ath/ath5k/debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath5k/debug.c +1 -1
index 4b41160e5..7c8823759 100644
@@ -982,7 +982,7 @@ ath5k_debug_init_device(struct ath5k_hw *ah)
 	ah->debug.level = ath5k_debug;
 
 	phydir = debugfs_create_dir("ath5k", ah->hw->wiphy->debugfsdir);
-	if (!phydir)
+	if (IS_ERR_OR_NULL(phydir))
 		return;
 
 	debugfs_create_file("debug", 0600, phydir, ah, &fops_debug);
Signature · 1 line
2.39.0
maintainer
#1 lore raw
Quoted 17 lines · Minjie Du

Make IS_ERR_OR_NULL() judge the debugfs_create_dir() function return in ath5k_debug_init_device().

---
v1-v2:
use IS_ERR_OR_NULL() instead of IS_ERR()

---
  drivers/net/wireless/ath/ath5k/debug.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath5k/debug.c +0 -0
index 4b41160e5..7c8823759 100644

drivers/net/wireless/ath/ath5k/debug.c ath5k_debug_init_device(struct ath5k_hw *ah) · line 985

Quoted 5 lines
drivers/net/wireless/ath/ath5k/debug.c +1 -1
@@ -982,7 +982,7 @@ ath5k_debug_init_device(struct ath5k_hw *ah)
  	ah->debug.level = ath5k_debug;
 
  	phydir = debugfs_create_dir("ath5k", ah->hw->wiphy->debugfsdir);
-	if (!phydir)
+	if (IS_ERR_OR_NULL(phydir))

When can debugfs_create_dir() return NULL?

Quoted 3 lines
drivers/net/wireless/ath/ath5k/debug.c +0 -0
  		return;
 
  	debugfs_create_file("debug", 0600, phydir, ah, &fops_debug);
Signature · 2 lines
js
suse labs
maintainer
#2 lore raw
In reply to Minjie Du
Quoted 17 lines · Minjie Du

Make IS_ERR_OR_NULL() judge the debugfs_create_dir() function return in ath5k_debug_init_device().

---
v1-v2:
use IS_ERR_OR_NULL() instead of IS_ERR()

---
  drivers/net/wireless/ath/ath5k/debug.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath5k/debug.c +0 -0
index 4b41160e5..7c8823759 100644

drivers/net/wireless/ath/ath5k/debug.c ath5k_debug_init_device(struct ath5k_hw *ah) · line 986

Quoted 6 lines
drivers/net/wireless/ath/ath5k/debug.c +1 -1
@@ -982,7 +982,7 @@ ath5k_debug_init_device(struct ath5k_hw *ah)
  	ah->debug.level = ath5k_debug;
 
  	phydir = debugfs_create_dir("ath5k", ah->hw->wiphy->debugfsdir);
-	if (!phydir)
+	if (IS_ERR_OR_NULL(phydir))
  		return;

And actually, in this case, remove the check completely (as per docs).

thanks,

Signature · 2 lines
js
suse labs