linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: ras: cec: return value check of `d`
@ 2023-04-23 12:29 Ruliang Lin
  2023-04-23 12:56 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: Ruliang Lin @ 2023-04-23 12:29 UTC (permalink / raw)
  To: Tony Luck, Borislav Petkov, Ingo Molnar
  Cc: hust-os-kernel-patches, Ruliang Lin, Dongliang Mu,
	Borislav Petkov, linux-edac, linux-kernel

Smatch complains that:
create_debugfs_nodes() warn: 'd' is an error pointer or valid

According to the documentation of the debugfs_create_dir() function, 
there is no need to check the return value of this function.
Just delete the dead code.

Fixes: 011d82611172 ("RAS: Add a Corrected Errors Collector")
Signed-off-by: Ruliang Lin <u202112092@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
---
 drivers/ras/cec.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
index 321af498ee11..d2a03f94cbfe 100644
--- a/drivers/ras/cec.c
+++ b/drivers/ras/cec.c
@@ -483,10 +483,6 @@ static int __init create_debugfs_nodes(void)
 	struct dentry *d, *pfn, *decay, *count, *array;
 
 	d = debugfs_create_dir("cec", ras_debugfs_dir);
-	if (!d) {
-		pr_warn("Error creating cec debugfs node!\n");
-		return -1;
-	}
 
 	decay = debugfs_create_file("decay_interval", S_IRUSR | S_IWUSR, d,
 				    &decay_interval, &decay_interval_ops);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers: ras: cec: return value check of `d`
  2023-04-23 12:29 [PATCH] drivers: ras: cec: return value check of `d` Ruliang Lin
@ 2023-04-23 12:56 ` Borislav Petkov
  0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2023-04-23 12:56 UTC (permalink / raw)
  To: Ruliang Lin
  Cc: Tony Luck, Ingo Molnar, hust-os-kernel-patches, Dongliang Mu,
	linux-edac, linux-kernel

On Sun, Apr 23, 2023 at 08:29:32PM +0800, Ruliang Lin wrote:
> According to the documentation of the debugfs_create_dir() function, 
> there is no need to check the return value of this function.

" * Drivers should generally work fine even if debugfs fails to init anyway."

Except that this particular driver won't if there is no debugfs
hierarchy created.

> Just delete the dead code.

So no, in this case it is not dead code but very much alive.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-23 12:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-23 12:29 [PATCH] drivers: ras: cec: return value check of `d` Ruliang Lin
2023-04-23 12:56 ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).