Thread (1 message) 1 message, 1 author, 2023-05-25

Re: [PATCH] nfcsim.c: Fix error checking for debugfs_create_dir

From: Simon Horman <hidden>
Date: 2023-05-25 08:12:39
Also in: linux-mediatek, linux-wireless, lkml

On Wed, May 24, 2023 at 08:55:06PM +0500, Osama Muhammad wrote:
This patch fixes the error checking in nfcsim.c in
debugfs_create_dir. The correct way to check if an error occurred
is using 'IS_ERR' inline function.

Signed-off-by: Osama Muhammad <redacted>
...

On Wed, May 24, 2023 at 09:03:52PM +0500, Osama Muhammad wrote:
This patch fixes the error checking in debugfs.c in
debugfs_create_dir. The correct way to check if an error occurred
is using 'IS_ERR' inline function.

Signed-off-by: Osama Muhammad <redacted>
...

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.

And I notice that in this same file there are calls to debugfs_create_dir()
where that advice is followed: the return value is ignored.

So I think the correct approaches here are to either:

1. Do nothing, the code isn't really broken
2. Remove the error checking

-- 
pw-bot: cr
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help