diff mbox series

[-next] pds_core: Remove redundant null pointer checks

Message ID 20240903143343.2004652-1-lizetao1@huawei.com (mailing list archive)
State Accepted
Commit 8ed6e71219a3571a5583db6f839e80eebaa2853d
Delegated to: Netdev Maintainers
Headers show
Series [-next] pds_core: Remove redundant null pointer checks | 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/ynl success Generated files up to date; no warnings/errors; no diff in generated;
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: 7 this patch: 7
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
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: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 32 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-09-04--15-00 (tests: 718)

Commit Message

lizetao Sept. 3, 2024, 2:33 p.m. UTC
Since the debugfs_create_dir() never returns a null pointer, checking
the return value for a null pointer is redundant, and using IS_ERR is
safe enough.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
 drivers/net/ethernet/amd/pds_core/debugfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Brett Creeley Sept. 3, 2024, 4:35 p.m. UTC | #1
On 9/3/2024 7:33 AM, Li Zetao wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> Since the debugfs_create_dir() never returns a null pointer, checking
> the return value for a null pointer is redundant, and using IS_ERR is
> safe enough.
> 
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
> ---
>   drivers/net/ethernet/amd/pds_core/debugfs.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/amd/pds_core/debugfs.c b/drivers/net/ethernet/amd/pds_core/debugfs.c
> index 6bdd02b7aa6d..ac37a4e738ae 100644
> --- a/drivers/net/ethernet/amd/pds_core/debugfs.c
> +++ b/drivers/net/ethernet/amd/pds_core/debugfs.c
> @@ -112,7 +112,7 @@ void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq)
>          struct pdsc_cq *cq = &qcq->cq;
> 
>          qcq_dentry = debugfs_create_dir(q->name, pdsc->dentry);
> -       if (IS_ERR_OR_NULL(qcq_dentry))
> +       if (IS_ERR(qcq_dentry))
>                  return;
>          qcq->dentry = qcq_dentry;
> 
> @@ -123,7 +123,7 @@ void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq)
>          debugfs_create_x32("accum_work", 0400, qcq_dentry, &qcq->accum_work);
> 
>          q_dentry = debugfs_create_dir("q", qcq->dentry);
> -       if (IS_ERR_OR_NULL(q_dentry))
> +       if (IS_ERR(q_dentry))
>                  return;
> 
>          debugfs_create_u32("index", 0400, q_dentry, &q->index);
> @@ -135,7 +135,7 @@ void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq)
>          debugfs_create_u16("head", 0400, q_dentry, &q->head_idx);
> 
>          cq_dentry = debugfs_create_dir("cq", qcq->dentry);
> -       if (IS_ERR_OR_NULL(cq_dentry))
> +       if (IS_ERR(cq_dentry))
>                  return;
> 
>          debugfs_create_x64("base_pa", 0400, cq_dentry, &cq->base_pa);
> @@ -148,7 +148,7 @@ void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq)
>                  struct pdsc_intr_info *intr = &pdsc->intr_info[qcq->intx];
> 
>                  intr_dentry = debugfs_create_dir("intr", qcq->dentry);
> -               if (IS_ERR_OR_NULL(intr_dentry))
> +               if (IS_ERR(intr_dentry))
>                          return;
> 

For the patch contents this LGTM.

However, the patch subject prefix should be "net-next".

Thanks,

Brett

>                  debugfs_create_u32("index", 0400, intr_dentry, &intr->index);
> --
> 2.34.1
>
patchwork-bot+netdevbpf@kernel.org Sept. 5, 2024, 12:10 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 3 Sep 2024 22:33:43 +0800 you wrote:
> Since the debugfs_create_dir() never returns a null pointer, checking
> the return value for a null pointer is redundant, and using IS_ERR is
> safe enough.
> 
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
> ---
>  drivers/net/ethernet/amd/pds_core/debugfs.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Here is the summary with links:
  - [-next] pds_core: Remove redundant null pointer checks
    https://git.kernel.org/netdev/net-next/c/8ed6e71219a3

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/amd/pds_core/debugfs.c b/drivers/net/ethernet/amd/pds_core/debugfs.c
index 6bdd02b7aa6d..ac37a4e738ae 100644
--- a/drivers/net/ethernet/amd/pds_core/debugfs.c
+++ b/drivers/net/ethernet/amd/pds_core/debugfs.c
@@ -112,7 +112,7 @@  void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq)
 	struct pdsc_cq *cq = &qcq->cq;
 
 	qcq_dentry = debugfs_create_dir(q->name, pdsc->dentry);
-	if (IS_ERR_OR_NULL(qcq_dentry))
+	if (IS_ERR(qcq_dentry))
 		return;
 	qcq->dentry = qcq_dentry;
 
@@ -123,7 +123,7 @@  void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq)
 	debugfs_create_x32("accum_work", 0400, qcq_dentry, &qcq->accum_work);
 
 	q_dentry = debugfs_create_dir("q", qcq->dentry);
-	if (IS_ERR_OR_NULL(q_dentry))
+	if (IS_ERR(q_dentry))
 		return;
 
 	debugfs_create_u32("index", 0400, q_dentry, &q->index);
@@ -135,7 +135,7 @@  void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq)
 	debugfs_create_u16("head", 0400, q_dentry, &q->head_idx);
 
 	cq_dentry = debugfs_create_dir("cq", qcq->dentry);
-	if (IS_ERR_OR_NULL(cq_dentry))
+	if (IS_ERR(cq_dentry))
 		return;
 
 	debugfs_create_x64("base_pa", 0400, cq_dentry, &cq->base_pa);
@@ -148,7 +148,7 @@  void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq)
 		struct pdsc_intr_info *intr = &pdsc->intr_info[qcq->intx];
 
 		intr_dentry = debugfs_create_dir("intr", qcq->dentry);
-		if (IS_ERR_OR_NULL(intr_dentry))
+		if (IS_ERR(intr_dentry))
 			return;
 
 		debugfs_create_u32("index", 0400, intr_dentry, &intr->index);