Skip to contentSkip to conversation

pktcdvd.c: Drop error checking for debugfs_create_dir

PATCH New Osama Muhammad 1 participant 1 message May 25, 2023 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pktcdvd.c: Drop error checking for debugfs_create_dir

This patch remove the error checking in pktcdvd.c. The DebugFS kernel API is developed in
a way that the caller can safely ignore the errors that occur during the creation of DebugFS nodes.

The comment above debugfs_create_dir includes the following text.

* NOTE: it's expected that most callers should _ignore_ the errors returned
* by this function. Other debugfs functions handle the fact that the "dentry"
* passed to them could be an error and they don't crash in that case.
* Drivers should generally work fine even if debugfs fails to init anyway.

---
 drivers/block/pktcdvd.c | 2 --
 1 file changed, 2 deletions(-)
drivers/block/pktcdvd.c +0 -2
index d5d7884cedd4..37cdd68c3de5 100644
@@ -451,8 +451,6 @@ static void pkt_debugfs_dev_new(struct pktcdvd_device *pd)
 	if (!pkt_debugfs_root)
 		return;
 	pd->dfs_d_root = debugfs_create_dir(pd->name, pkt_debugfs_root);
-	if (!pd->dfs_d_root)
-		return;
 
 	pd->dfs_f_info = debugfs_create_file("info", 0444,
 					     pd->dfs_d_root, pd, &debug_fops);
Signature · 1 line
2.34.1