[PATCH 1/1] ath11k: fix return value check in ath11k_spectral_debug_register()

Zhen Lei thunder.leizhen at huawei.com
Wed Oct 23 00:40:51 PDT 2024


Fix the incorrect return value check for debugfs_create_file(), which
returns ERR_PTR(-ERROR) instead of NULL when it fails.

Fixes: 9d11b7bff950 ("ath11k: add support for spectral scan")
Signed-off-by: Zhen Lei <thunder.leizhen at huawei.com>
---
 drivers/net/wireless/ath/ath11k/spectral.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/spectral.c b/drivers/net/wireless/ath/ath11k/spectral.c
index 79e091134515b43..4c545231292142a 100644
--- a/drivers/net/wireless/ath/ath11k/spectral.c
+++ b/drivers/net/wireless/ath/ath11k/spectral.c
@@ -942,7 +942,7 @@ static inline int ath11k_spectral_debug_register(struct ath11k *ar)
 						    0600,
 						    ar->debug.debugfs_pdev, ar,
 						    &fops_scan_ctl);
-	if (!ar->spectral.scan_ctl) {
+	if (IS_ERR(ar->spectral.scan_ctl)) {
 		ath11k_warn(ar->ab, "failed to open debugfs in pdev %d\n",
 			    ar->pdev_idx);
 		ret = -EINVAL;
@@ -953,7 +953,7 @@ static inline int ath11k_spectral_debug_register(struct ath11k *ar)
 						      0600,
 						      ar->debug.debugfs_pdev, ar,
 						      &fops_scan_count);
-	if (!ar->spectral.scan_count) {
+	if (IS_ERR(ar->spectral.scan_count)) {
 		ath11k_warn(ar->ab, "failed to open debugfs in pdev %d\n",
 			    ar->pdev_idx);
 		ret = -EINVAL;
@@ -964,7 +964,7 @@ static inline int ath11k_spectral_debug_register(struct ath11k *ar)
 						     0600,
 						     ar->debug.debugfs_pdev, ar,
 						     &fops_scan_bins);
-	if (!ar->spectral.scan_bins) {
+	if (IS_ERR(ar->spectral.scan_bins)) {
 		ath11k_warn(ar->ab, "failed to open debugfs in pdev %d\n",
 			    ar->pdev_idx);
 		ret = -EINVAL;
-- 
2.34.1




More information about the ath11k mailing list