mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
octeontx2-af: npc: cn20k: Drop debugfs_create_file() error checks in init
debugfs is not intended to be checked for allocation failures the way other
kernel APIs are: callers should not fail probe or subsystem init because a
debugfs node could not be created, including when debugfs is disabled in
Kconfig. Replacing NULL checks with IS_ERR() checks is similarly wrong for
optional debugfs.
Remove dentry checks and -EFAULT returns from npc_cn20k_debugfs_init().
See:
https://staticthinking.wordpress.com/2023/07/24/
debugfs-functions-are-not-supposed-to-be-checked/
Cc: Dan Carpenter <error27@gmail.com>
Fixes: 528530dff5 ("octeontx2-af: npc: cn20k: add debugfs support")
Link: https://lore.kernel.org/netdev/adjNGPWKMOk3KgWL@stanley.mountain/
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
Link: https://patch.msgid.link/20260429022722.1110289-3-rkannoth@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
aaadccde31
commit
1100af13fd
|
|
@ -249,34 +249,21 @@ DEFINE_SHOW_ATTRIBUTE(npc_defrag);
|
|||
int npc_cn20k_debugfs_init(struct rvu *rvu)
|
||||
{
|
||||
struct npc_priv_t *npc_priv = npc_priv_get();
|
||||
struct dentry *npc_dentry;
|
||||
|
||||
npc_dentry = debugfs_create_file("mcam_layout", 0444, rvu->rvu_dbg.npc,
|
||||
npc_priv, &npc_mcam_layout_fops);
|
||||
debugfs_create_file("mcam_layout", 0444, rvu->rvu_dbg.npc,
|
||||
npc_priv, &npc_mcam_layout_fops);
|
||||
|
||||
if (!npc_dentry)
|
||||
return -EFAULT;
|
||||
debugfs_create_file("mcam_default", 0444, rvu->rvu_dbg.npc,
|
||||
rvu, &npc_mcam_default_fops);
|
||||
|
||||
npc_dentry = debugfs_create_file("mcam_default", 0444, rvu->rvu_dbg.npc,
|
||||
rvu, &npc_mcam_default_fops);
|
||||
debugfs_create_file("vidx2idx", 0444, rvu->rvu_dbg.npc,
|
||||
npc_priv, &npc_vidx2idx_map_fops);
|
||||
|
||||
if (!npc_dentry)
|
||||
return -EFAULT;
|
||||
debugfs_create_file("idx2vidx", 0444, rvu->rvu_dbg.npc,
|
||||
npc_priv, &npc_idx2vidx_map_fops);
|
||||
|
||||
npc_dentry = debugfs_create_file("vidx2idx", 0444, rvu->rvu_dbg.npc,
|
||||
npc_priv, &npc_vidx2idx_map_fops);
|
||||
if (!npc_dentry)
|
||||
return -EFAULT;
|
||||
|
||||
npc_dentry = debugfs_create_file("idx2vidx", 0444, rvu->rvu_dbg.npc,
|
||||
npc_priv, &npc_idx2vidx_map_fops);
|
||||
if (!npc_dentry)
|
||||
return -EFAULT;
|
||||
|
||||
npc_dentry = debugfs_create_file("defrag", 0444, rvu->rvu_dbg.npc,
|
||||
npc_priv, &npc_defrag_fops);
|
||||
if (!npc_dentry)
|
||||
return -EFAULT;
|
||||
debugfs_create_file("defrag", 0444, rvu->rvu_dbg.npc,
|
||||
npc_priv, &npc_defrag_fops);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user