diff mbox series

[v1] drivers/net: intel: iwlwifi: fix two parameters check in iwl_mei_dbgfs_register()

Message ID 20230712131407.16462-1-duminjie@vivo.com (mailing list archive)
State New
Delegated to: Miri Korenblit
Headers show
Series [v1] drivers/net: intel: iwlwifi: fix two parameters check in iwl_mei_dbgfs_register() | expand

Commit Message

Minjie Du July 12, 2023, 1:14 p.m. UTC
Make IS_ERR() judge the debugfs_create_dir() function return
in iwl_mei_dbgfs_register().

Signed-off-by: Minjie Du <duminjie@vivo.com>
---
 drivers/net/wireless/intel/iwlwifi/mei/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nicolas Escande July 12, 2023, 2:01 p.m. UTC | #1
On Wed Jul 12, 2023 at 3:14 PM CEST, Minjie Du wrote:
> Make IS_ERR() judge the debugfs_create_dir() function return
> in iwl_mei_dbgfs_register().
>
> Signed-off-by: Minjie Du <duminjie@vivo.com>
> ---
>  drivers/net/wireless/intel/iwlwifi/mei/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/intel/iwlwifi/mei/main.c b/drivers/net/wireless/intel/iwlwifi/mei/main.c
> index 54445f39f..e5d203a62 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mei/main.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mei/main.c
> @@ -1888,7 +1888,7 @@ static void iwl_mei_dbgfs_register(struct iwl_mei *mei)
>  {
>  	mei->dbgfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
>  
> -	if (!mei->dbgfs_dir)
> +	if (IS_ERR(mei->dbgfs_dir))
>  		return;

same as the other one

>  
>  	debugfs_create_ulong("status", S_IRUSR,
Greenman, Gregory Aug. 13, 2023, 3:27 p.m. UTC | #2
Hi,

On Wed, 2023-07-12 at 21:14 +0800, Minjie Du wrote:
> Make IS_ERR() judge the debugfs_create_dir() function return
> in iwl_mei_dbgfs_register().
> 
> Signed-off-by: Minjie Du <duminjie@vivo.com>
> ---
>  drivers/net/wireless/intel/iwlwifi/mei/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/mei/main.c b/drivers/net/wireless/intel/iwlwifi/mei/main.c
> index 54445f39f..e5d203a62 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mei/main.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mei/main.c
> @@ -1888,7 +1888,7 @@ static void iwl_mei_dbgfs_register(struct iwl_mei *mei)
>  {
>         mei->dbgfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
>  
> -       if (!mei->dbgfs_dir)
> +       if (IS_ERR(mei->dbgfs_dir))
>                 return;
>  
>         debugfs_create_ulong("status", S_IRUSR,

The title should be:

wifi: iwlwifi: mei: ...

Also, why two parameters? It only fixes dbgfs_dir?
Kalle Valo Aug. 21, 2023, 12:46 p.m. UTC | #3
"Greenman, Gregory" <gregory.greenman@intel.com> writes:

> Hi,
>
> On Wed, 2023-07-12 at 21:14 +0800, Minjie Du wrote:
>> Make IS_ERR() judge the debugfs_create_dir() function return
>> in iwl_mei_dbgfs_register().
>> 
>> Signed-off-by: Minjie Du <duminjie@vivo.com>
>> ---
>>  drivers/net/wireless/intel/iwlwifi/mei/main.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/net/wireless/intel/iwlwifi/mei/main.c
>> b/drivers/net/wireless/intel/iwlwifi/mei/main.c
>> index 54445f39f..e5d203a62 100644
>> --- a/drivers/net/wireless/intel/iwlwifi/mei/main.c
>> +++ b/drivers/net/wireless/intel/iwlwifi/mei/main.c
>> @@ -1888,7 +1888,7 @@ static void iwl_mei_dbgfs_register(struct iwl_mei *mei)
>>  {
>>         mei->dbgfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
>>  
>> -       if (!mei->dbgfs_dir)
>> +       if (IS_ERR(mei->dbgfs_dir))
>>                 return;
>>  
>>         debugfs_create_ulong("status", S_IRUSR,
>
> The title should be:
>
> wifi: iwlwifi: mei: ...
>
> Also, why two parameters? It only fixes dbgfs_dir?

It would be better to just remove the check, from debugfs_create_dir():

 * NOTE: it's expected that most callers should _ignore_ the errors returned
 * by this function. Other debugfs functions handle the fact that the "dentry"
 * passed to them could be an error and they don't crash in that case.
 * Drivers should generally work fine even if debugfs fails to init anyway.
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/mei/main.c b/drivers/net/wireless/intel/iwlwifi/mei/main.c
index 54445f39f..e5d203a62 100644
--- a/drivers/net/wireless/intel/iwlwifi/mei/main.c
+++ b/drivers/net/wireless/intel/iwlwifi/mei/main.c
@@ -1888,7 +1888,7 @@  static void iwl_mei_dbgfs_register(struct iwl_mei *mei)
 {
 	mei->dbgfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
 
-	if (!mei->dbgfs_dir)
+	if (IS_ERR(mei->dbgfs_dir))
 		return;
 
 	debugfs_create_ulong("status", S_IRUSR,