mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ath5k: Fix debugfs_create_dir error checking
@ 2023-07-31  2:38 Atul Raut
  2023-07-31  5:20 ` Jiri Slaby
  0 siblings, 1 reply; 2+ messages in thread
From: Atul Raut @ 2023-07-31  2:38 UTC (permalink / raw)
  To: jirislaby, mickflemm, mcgrof, kvalo
  Cc: linux-wireless, linux-kernel, linux-kernel-mentees

The debugfs_create_dir function returns ERR_PTR
in case of error and the correct way to check an
error is 'IS_ERR' inline function.
This patch will replace the null-comparison with IS_ERR

This issue was found with the help of Coccinelle.
./drivers/net/wireless/ath/ath5k/debug.c:985:6-12: Wrong debugfs call error processing on line 985

Signed-off-by: Atul Raut <rauji.raut@gmail.com>
---
 drivers/net/wireless/ath/ath5k/debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
index 4b41160e5d38..08058b3f7e22 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -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(phydir))
 		return;
 
 	debugfs_create_file("debug", 0600, phydir, ah, &fops_debug);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ath5k: Fix debugfs_create_dir error checking
  2023-07-31  2:38 [PATCH] ath5k: Fix debugfs_create_dir error checking Atul Raut
@ 2023-07-31  5:20 ` Jiri Slaby
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Slaby @ 2023-07-31  5:20 UTC (permalink / raw)
  To: Atul Raut, mickflemm, mcgrof, kvalo
  Cc: linux-wireless, linux-kernel, linux-kernel-mentees

On 31. 07. 23, 4:38, Atul Raut wrote:
> The debugfs_create_dir function returns ERR_PTR
> in case of error and the correct way to check an
> error is 'IS_ERR' inline function.
> This patch will replace the null-comparison with IS_ERR
> 
> This issue was found with the help of Coccinelle.
> ./drivers/net/wireless/ath/ath5k/debug.c:985:6-12: Wrong debugfs call error processing on line 985
> 
> Signed-off-by: Atul Raut <rauji.raut@gmail.com>
> ---
>   drivers/net/wireless/ath/ath5k/debug.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
> index 4b41160e5d38..08058b3f7e22 100644
> --- a/drivers/net/wireless/ath/ath5k/debug.c
> +++ b/drivers/net/wireless/ath/ath5k/debug.c
> @@ -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(phydir))

Already fixed by:
https://patchwork.kernel.org/project/linux-wireless/patch/20230714081619.2032-1-duminjie@vivo.com/

-- 
js
suse labs


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-31  5:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-31  2:38 [PATCH] ath5k: Fix debugfs_create_dir error checking Atul Raut
2023-07-31  5:20 ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®