diff mbox series

[v2] net:Fix an NULL vs IS_ERR() bug for debugfs_create_dir() in i40e_dbg_init()

Message ID 20230712121943.7597-1-machel@vivo.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [v2] net:Fix an NULL vs IS_ERR() bug for debugfs_create_dir() in i40e_dbg_init() | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1341 this patch: 1341
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 1364 this patch: 1364
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1364 this patch: 1364
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Wang Ming July 12, 2023, 12:19 p.m. UTC
The debugfs_create_dir() function returns error pointers.
It never returns NULL. Most incorrect error checks were fixed,
but the one in i40e_dbg_init() was forgotten.

Fix the remaining error check.

Signed-off-by: Wang Ming <machel@vivo.com>
---
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tony Nguyen July 12, 2023, 8:57 p.m. UTC | #1
On 7/12/2023 5:19 AM, Wang Ming wrote:

Please designate a tree for the patch (net or net-next) [1].

If you could include the driver (i40e) in the commit title as well. 
Also, a nit, but the title is a bit long, seems like it could be a bit 
more succinct.

> The debugfs_create_dir() function returns error pointers.
> It never returns NULL. Most incorrect error checks were fixed,
> but the one in i40e_dbg_init() was forgotten.
> 
> Fix the remaining error check.

As it's a fix, there should be a Fixes tag as well.

> Signed-off-by: Wang Ming <machel@vivo.com>
> ---
>   drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
> index 9954493cd448..62497f5565c5 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
> @@ -1839,7 +1839,7 @@ void i40e_dbg_pf_exit(struct i40e_pf *pf)
>   void i40e_dbg_init(void)
>   {
>   	i40e_dbg_root = debugfs_create_dir(i40e_driver_name, NULL);
> -	if (!i40e_dbg_root)
> +	if (IS_ERR(i40e_dbg_root))
>   		pr_info("init of debugfs failed\n");
>   }
>   

[1] 
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html#netdev-faq
Wang Ming July 13, 2023, 1:15 a.m. UTC | #2
okay, I'm following your advice and resubmitting

-----邮件原件-----
发件人: Tony Nguyen <anthony.l.nguyen@intel.com> 
发送时间: 2023年7月13日 4:57
收件人: 王明-软件底层技术部 <machel@vivo.com>; Jesse Brandeburg <jesse.brandeburg@intel.com>; David S. Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; linux-kernel@vger.kernel.org
抄送: opensource.kernel <opensource.kernel@vivo.com>
主题: Re: [PATCH v2] net:Fix an NULL vs IS_ERR() bug for debugfs_create_dir() in i40e_dbg_init()

On 7/12/2023 5:19 AM, Wang Ming wrote:

Please designate a tree for the patch (net or net-next) [1].

If you could include the driver (i40e) in the commit title as well. 
Also, a nit, but the title is a bit long, seems like it could be a bit more succinct.

> The debugfs_create_dir() function returns error pointers.
> It never returns NULL. Most incorrect error checks were fixed, but the 
> one in i40e_dbg_init() was forgotten.
> 
> Fix the remaining error check.

As it's a fix, there should be a Fixes tag as well.

> Signed-off-by: Wang Ming <machel@vivo.com>
> ---
>   drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c 
> b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
> index 9954493cd448..62497f5565c5 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
> @@ -1839,7 +1839,7 @@ void i40e_dbg_pf_exit(struct i40e_pf *pf)
>   void i40e_dbg_init(void)
>   {
>   	i40e_dbg_root = debugfs_create_dir(i40e_driver_name, NULL);
> -	if (!i40e_dbg_root)
> +	if (IS_ERR(i40e_dbg_root))
>   		pr_info("init of debugfs failed\n");
>   }
>   

[1]
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html#netdev-faq
Wang Ming July 13, 2023, 1:54 a.m. UTC | #3
Hi Tony Nguyen
good morning, I have resubmitted patch according to your requirements, please review it when you are free, I will be very grateful.

diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
index 9954493cd448..62497f5565c5 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
@@ -1839,7 +1839,7 @@  void i40e_dbg_pf_exit(struct i40e_pf *pf)
 void i40e_dbg_init(void)
 {
 	i40e_dbg_root = debugfs_create_dir(i40e_driver_name, NULL);
-	if (!i40e_dbg_root)
+	if (IS_ERR(i40e_dbg_root))
 		pr_info("init of debugfs failed\n");
 }