[PATCH] debugfs.c: Fix error checking for debugfs_create_dir

From: Osama Muhammad
Date: Wed May 24 2023 - 12:05:24 EST


This patch fixes the error checking in debugfs.c in
debugfs_create_dir. The correct way to check if an error occurred
is using 'IS_ERR' inline function.

Signed-off-by: Osama Muhammad <osmtendev@xxxxxxxxx>
---
drivers/net/wireless/mediatek/mt76/debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/debugfs.c b/drivers/net/wireless/mediatek/mt76/debugfs.c
index 57fbcc83e074..d9ba700131fd 100644
--- a/drivers/net/wireless/mediatek/mt76/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/debugfs.c
@@ -109,7 +109,7 @@ mt76_register_debugfs_fops(struct mt76_phy *phy,
struct dentry *dir;

dir = debugfs_create_dir("mt76", phy->hw->wiphy->debugfsdir);
- if (!dir)
+ if (IS_ERR(dir))
return NULL;

debugfs_create_u8("led_pin", 0600, dir, &phy->leds.pin);
--
2.34.1