public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Ratheesh Kannoth <rkannoth@marvell.com>
Cc: netdev@vger.kernel.org
Subject: [bug report] octeontx2-af: npc: cn20k: add debugfs support
Date: Fri, 10 Apr 2026 13:12:40 +0300	[thread overview]
Message-ID: <adjNGPWKMOk3KgWL@stanley.mountain> (raw)

Hello Ratheesh Kannoth,

Commit 528530dff56b ("octeontx2-af: npc: cn20k: add debugfs support")
from Feb 24, 2026 (linux-next), leads to the following Smatch static
checker warning:

drivers/net/ethernet/marvell/octeontx2/af/cn20k/debugfs.c:257 npc_cn20k_debugfs_init() warn: 'npc_dentry' is an error pointer or valid
drivers/net/ethernet/marvell/octeontx2/af/cn20k/debugfs.c:263 npc_cn20k_debugfs_init() warn: 'npc_dentry' is an error pointer or valid
drivers/net/ethernet/marvell/octeontx2/af/cn20k/debugfs.c:268 npc_cn20k_debugfs_init() warn: 'npc_dentry' is an error pointer or valid
drivers/net/ethernet/marvell/octeontx2/af/cn20k/debugfs.c:273 npc_cn20k_debugfs_init() warn: 'npc_dentry' is an error pointer or valid
drivers/net/ethernet/marvell/octeontx2/af/cn20k/debugfs.c:278 npc_cn20k_debugfs_init() warn: 'npc_dentry' is an error pointer or valid

drivers/net/ethernet/marvell/octeontx2/af/cn20k/debugfs.c
    249 int npc_cn20k_debugfs_init(struct rvu *rvu)
    250 {
    251         struct npc_priv_t *npc_priv = npc_priv_get();
    252         struct dentry *npc_dentry;
    253 
    254         npc_dentry = debugfs_create_file("mcam_layout", 0444, rvu->rvu_dbg.npc,
    255                                          npc_priv, &npc_mcam_layout_fops);
    256 
    257         if (!npc_dentry)
    258                 return -EFAULT;

This error checking is wrong, but instead of fixing it, just delete it.
See my blog for details:

https://staticthinking.wordpress.com/2023/07/24/debugfs-functions-are-not-supposed-to-be-checked/

    259 
    260         npc_dentry = debugfs_create_file("mcam_default", 0444, rvu->rvu_dbg.npc,
    261                                          rvu, &npc_mcam_default_fops);
    262 
    263         if (!npc_dentry)
    264                 return -EFAULT;
    265 
    266         npc_dentry = debugfs_create_file("vidx2idx", 0444, rvu->rvu_dbg.npc,
    267                                          npc_priv, &npc_vidx2idx_map_fops);
    268         if (!npc_dentry)
    269                 return -EFAULT;
    270 
    271         npc_dentry = debugfs_create_file("idx2vidx", 0444, rvu->rvu_dbg.npc,
    272                                          npc_priv, &npc_idx2vidx_map_fops);
    273         if (!npc_dentry)
    274                 return -EFAULT;
    275 
    276         npc_dentry = debugfs_create_file("defrag", 0444, rvu->rvu_dbg.npc,
    277                                          npc_priv, &npc_defrag_fops);
--> 278         if (!npc_dentry)
    279                 return -EFAULT;
    280 
    281         return 0;
    282 }

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter

                 reply	other threads:[~2026-04-10 10:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adjNGPWKMOk3KgWL@stanley.mountain \
    --to=error27@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=rkannoth@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox