public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] octeontx2-af: npc: cn20k: add debugfs support
@ 2026-04-10 10:12 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2026-04-10 10:12 UTC (permalink / raw)
  To: Ratheesh Kannoth; +Cc: netdev

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-10 10:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-10 10:12 [bug report] octeontx2-af: npc: cn20k: add debugfs support Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox