* [PATCH net-next v3] wifi: ath9k: Remove error checking for debugfs_create_dir()
@ 2023-07-26 11:07 Wang Ming
2023-07-27 15:55 ` Kalle Valo
2023-08-08 13:28 ` Toke Høiland-Jørgensen
0 siblings, 2 replies; 7+ messages in thread
From: Wang Ming @ 2023-07-26 11:07 UTC (permalink / raw)
To: Toke Høiland-Jørgensen, Kalle Valo, linux-wireless,
linux-kernel
Cc: opensource.kernel, Wang Ming
It is expected that most callers should _ignore_ the errors
return by debugfs_create_dir() in ath9k_htc_init_debug().
Signed-off-by: Wang Ming <machel@vivo.com>
---
drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
index b3ed65e5c4da..85ad45771b44 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
@@ -491,8 +491,6 @@ int ath9k_htc_init_debug(struct ath_hw *ah)
priv->debug.debugfs_phy = debugfs_create_dir(KBUILD_MODNAME,
priv->hw->wiphy->debugfsdir);
- if (!priv->debug.debugfs_phy)
- return -ENOMEM;
ath9k_cmn_spectral_init_debug(&priv->spec_priv, priv->debug.debugfs_phy);
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v3] wifi: ath9k: Remove error checking for debugfs_create_dir()
2023-07-26 11:07 [PATCH net-next v3] wifi: ath9k: Remove error checking for debugfs_create_dir() Wang Ming
@ 2023-07-27 15:55 ` Kalle Valo
2023-08-08 13:28 ` Toke Høiland-Jørgensen
1 sibling, 0 replies; 7+ messages in thread
From: Kalle Valo @ 2023-07-27 15:55 UTC (permalink / raw)
To: Wang Ming
Cc: Toke Høiland-Jørgensen, linux-wireless, linux-kernel,
opensource.kernel
Wang Ming <machel@vivo.com> writes:
> It is expected that most callers should _ignore_ the errors
> return by debugfs_create_dir() in ath9k_htc_init_debug().
>
> Signed-off-by: Wang Ming <machel@vivo.com>
ath9k patches go to ath-next, not net-next. So do *not* put net-next
into Subject. No need to resend because of this.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v3] wifi: ath9k: Remove error checking for debugfs_create_dir()
2023-07-26 11:07 [PATCH net-next v3] wifi: ath9k: Remove error checking for debugfs_create_dir() Wang Ming
2023-07-27 15:55 ` Kalle Valo
@ 2023-08-08 13:28 ` Toke Høiland-Jørgensen
2023-08-21 12:39 ` Kalle Valo
1 sibling, 1 reply; 7+ messages in thread
From: Toke Høiland-Jørgensen @ 2023-08-08 13:28 UTC (permalink / raw)
To: Wang Ming, Kalle Valo, linux-wireless, linux-kernel
Cc: opensource.kernel, Wang Ming
Wang Ming <machel@vivo.com> writes:
> It is expected that most callers should _ignore_ the errors
> return by debugfs_create_dir() in ath9k_htc_init_debug().
>
> Signed-off-by: Wang Ming <machel@vivo.com>
> ---
> drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
> index b3ed65e5c4da..85ad45771b44 100644
> --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
> @@ -491,8 +491,6 @@ int ath9k_htc_init_debug(struct ath_hw *ah)
>
> priv->debug.debugfs_phy = debugfs_create_dir(KBUILD_MODNAME,
> priv->hw->wiphy->debugfsdir);
> - if (!priv->debug.debugfs_phy)
> - return -ENOMEM;
Hmm, so it's true that all the debugfs_create* functions deal correctly
with the dir pointer being an error pointer, which means that it's
possible to just ignore the return value of debugfs_create_dir() without
anything breaking. However, it also seems kinda pointless to have all
those calls if we know they're going to fail, so I prefer v1 of this
patch that just fixed the IS_ERR check. No need to resend, we can just
apply v1 instead...
-Toke
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v3] wifi: ath9k: Remove error checking for debugfs_create_dir()
2023-08-08 13:28 ` Toke Høiland-Jørgensen
@ 2023-08-21 12:39 ` Kalle Valo
2023-08-21 13:55 ` Toke Høiland-Jørgensen
0 siblings, 1 reply; 7+ messages in thread
From: Kalle Valo @ 2023-08-21 12:39 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: Wang Ming, linux-wireless, linux-kernel, opensource.kernel
Toke Høiland-Jørgensen <toke@toke.dk> writes:
> Wang Ming <machel@vivo.com> writes:
>
>> It is expected that most callers should _ignore_ the errors
>> return by debugfs_create_dir() in ath9k_htc_init_debug().
>>
>> Signed-off-by: Wang Ming <machel@vivo.com>
>> ---
>> drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 2 --
>> 1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
>> index b3ed65e5c4da..85ad45771b44 100644
>> --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
>> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
>> @@ -491,8 +491,6 @@ int ath9k_htc_init_debug(struct ath_hw *ah)
>>
>> priv->debug.debugfs_phy = debugfs_create_dir(KBUILD_MODNAME,
>> priv->hw->wiphy->debugfsdir);
>> - if (!priv->debug.debugfs_phy)
>> - return -ENOMEM;
>
> Hmm, so it's true that all the debugfs_create* functions deal correctly
> with the dir pointer being an error pointer, which means that it's
> possible to just ignore the return value of debugfs_create_dir() without
> anything breaking.
The comment in debugfs_create_dir() states:
* 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.
> However, it also seems kinda pointless to have all those calls if we
> know they're going to fail, so I prefer v1 of this patch that just
> fixed the IS_ERR check. No need to resend, we can just apply v1
> instead...
Because of the comment I'm leaning towards v3.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v3] wifi: ath9k: Remove error checking for debugfs_create_dir()
2023-08-21 12:39 ` Kalle Valo
@ 2023-08-21 13:55 ` Toke Høiland-Jørgensen
2023-08-22 5:44 ` Kalle Valo
0 siblings, 1 reply; 7+ messages in thread
From: Toke Høiland-Jørgensen @ 2023-08-21 13:55 UTC (permalink / raw)
To: Kalle Valo; +Cc: Wang Ming, linux-wireless, linux-kernel, opensource.kernel
Kalle Valo <kvalo@kernel.org> writes:
> Toke Høiland-Jørgensen <toke@toke.dk> writes:
>
>> Wang Ming <machel@vivo.com> writes:
>>
>>> It is expected that most callers should _ignore_ the errors
>>> return by debugfs_create_dir() in ath9k_htc_init_debug().
>>>
>>> Signed-off-by: Wang Ming <machel@vivo.com>
>>> ---
>>> drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 2 --
>>> 1 file changed, 2 deletions(-)
>>>
>>> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
>>> index b3ed65e5c4da..85ad45771b44 100644
>>> --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
>>> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
>>> @@ -491,8 +491,6 @@ int ath9k_htc_init_debug(struct ath_hw *ah)
>>>
>>> priv->debug.debugfs_phy = debugfs_create_dir(KBUILD_MODNAME,
>>> priv->hw->wiphy->debugfsdir);
>>> - if (!priv->debug.debugfs_phy)
>>> - return -ENOMEM;
>>
>> Hmm, so it's true that all the debugfs_create* functions deal correctly
>> with the dir pointer being an error pointer, which means that it's
>> possible to just ignore the return value of debugfs_create_dir() without
>> anything breaking.
>
> The comment in debugfs_create_dir() states:
>
> * 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.
>
>> However, it also seems kinda pointless to have all those calls if we
>> know they're going to fail, so I prefer v1 of this patch that just
>> fixed the IS_ERR check. No need to resend, we can just apply v1
>> instead...
>
> Because of the comment I'm leaning towards v3.
Well, the comment says "most callers" :)
I think having an early return like this is perfectly valid
optimisation, even if it doesn't really make any performance difference.
I don't feel incredibly strongly about it (given that the current check
is broken I guess the early return has never actually worked), so if you
feel like overriding your submaintainer on this, feel free ;)
-Toke
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v3] wifi: ath9k: Remove error checking for debugfs_create_dir()
2023-08-21 13:55 ` Toke Høiland-Jørgensen
@ 2023-08-22 5:44 ` Kalle Valo
2023-08-22 8:01 ` Toke Høiland-Jørgensen
0 siblings, 1 reply; 7+ messages in thread
From: Kalle Valo @ 2023-08-22 5:44 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: Wang Ming, linux-wireless, linux-kernel, opensource.kernel
Toke Høiland-Jørgensen <toke@toke.dk> writes:
> Kalle Valo <kvalo@kernel.org> writes:
>
>> Toke Høiland-Jørgensen <toke@toke.dk> writes:
>>
>>> Wang Ming <machel@vivo.com> writes:
>>>
>>>> It is expected that most callers should _ignore_ the errors
>>>> return by debugfs_create_dir() in ath9k_htc_init_debug().
>>>>
>>>> Signed-off-by: Wang Ming <machel@vivo.com>
>>>> ---
>>>> drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 2 --
>>>> 1 file changed, 2 deletions(-)
>>>>
>>>> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
>>>> index b3ed65e5c4da..85ad45771b44 100644
>>>> --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
>>>> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
>>>> @@ -491,8 +491,6 @@ int ath9k_htc_init_debug(struct ath_hw *ah)
>>>>
>>>> priv->debug.debugfs_phy = debugfs_create_dir(KBUILD_MODNAME,
>>>> priv->hw->wiphy->debugfsdir);
>>>> - if (!priv->debug.debugfs_phy)
>>>> - return -ENOMEM;
>>>
>>> Hmm, so it's true that all the debugfs_create* functions deal correctly
>>> with the dir pointer being an error pointer, which means that it's
>>> possible to just ignore the return value of debugfs_create_dir() without
>>> anything breaking.
>>
>> The comment in debugfs_create_dir() states:
>>
>> * 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.
>>
>>> However, it also seems kinda pointless to have all those calls if we
>>> know they're going to fail, so I prefer v1 of this patch that just
>>> fixed the IS_ERR check. No need to resend, we can just apply v1
>>> instead...
>>
>> Because of the comment I'm leaning towards v3.
>
> Well, the comment says "most callers" :)
>
> I think having an early return like this is perfectly valid
> optimisation, even if it doesn't really make any performance difference.
> I don't feel incredibly strongly about it (given that the current check
> is broken I guess the early return has never actually worked), so if you
> feel like overriding your submaintainer on this, feel free ;)
No no, I don't want to override anything :) Just making sure you were
aware of the comment. v1 is in my pending branch right now.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v3] wifi: ath9k: Remove error checking for debugfs_create_dir()
2023-08-22 5:44 ` Kalle Valo
@ 2023-08-22 8:01 ` Toke Høiland-Jørgensen
0 siblings, 0 replies; 7+ messages in thread
From: Toke Høiland-Jørgensen @ 2023-08-22 8:01 UTC (permalink / raw)
To: Kalle Valo; +Cc: Wang Ming, linux-wireless, linux-kernel, opensource.kernel
Kalle Valo <kvalo@kernel.org> writes:
> Toke Høiland-Jørgensen <toke@toke.dk> writes:
>
>> Kalle Valo <kvalo@kernel.org> writes:
>>
>>> Toke Høiland-Jørgensen <toke@toke.dk> writes:
>>>
>>>> Wang Ming <machel@vivo.com> writes:
>>>>
>>>>> It is expected that most callers should _ignore_ the errors
>>>>> return by debugfs_create_dir() in ath9k_htc_init_debug().
>>>>>
>>>>> Signed-off-by: Wang Ming <machel@vivo.com>
>>>>> ---
>>>>> drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 2 --
>>>>> 1 file changed, 2 deletions(-)
>>>>>
>>>>> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
>>>>> index b3ed65e5c4da..85ad45771b44 100644
>>>>> --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
>>>>> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
>>>>> @@ -491,8 +491,6 @@ int ath9k_htc_init_debug(struct ath_hw *ah)
>>>>>
>>>>> priv->debug.debugfs_phy = debugfs_create_dir(KBUILD_MODNAME,
>>>>> priv->hw->wiphy->debugfsdir);
>>>>> - if (!priv->debug.debugfs_phy)
>>>>> - return -ENOMEM;
>>>>
>>>> Hmm, so it's true that all the debugfs_create* functions deal correctly
>>>> with the dir pointer being an error pointer, which means that it's
>>>> possible to just ignore the return value of debugfs_create_dir() without
>>>> anything breaking.
>>>
>>> The comment in debugfs_create_dir() states:
>>>
>>> * 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.
>>>
>>>> However, it also seems kinda pointless to have all those calls if we
>>>> know they're going to fail, so I prefer v1 of this patch that just
>>>> fixed the IS_ERR check. No need to resend, we can just apply v1
>>>> instead...
>>>
>>> Because of the comment I'm leaning towards v3.
>>
>> Well, the comment says "most callers" :)
>>
>> I think having an early return like this is perfectly valid
>> optimisation, even if it doesn't really make any performance difference.
>> I don't feel incredibly strongly about it (given that the current check
>> is broken I guess the early return has never actually worked), so if you
>> feel like overriding your submaintainer on this, feel free ;)
>
> No no, I don't want to override anything :) Just making sure you were
> aware of the comment. v1 is in my pending branch right now.
Alright, cool :)
-Toke
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-08-22 8:03 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-26 11:07 [PATCH net-next v3] wifi: ath9k: Remove error checking for debugfs_create_dir() Wang Ming
2023-07-27 15:55 ` Kalle Valo
2023-08-08 13:28 ` Toke Høiland-Jørgensen
2023-08-21 12:39 ` Kalle Valo
2023-08-21 13:55 ` Toke Høiland-Jørgensen
2023-08-22 5:44 ` Kalle Valo
2023-08-22 8:01 ` Toke Høiland-Jørgensen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).