diff mbox series

[1/1] RAS: Fix return value check in create_debugfs_nodes()

Message ID 20241023071325.292-1-thunder.leizhen@huawei.com (mailing list archive)
State New
Headers show
Series [1/1] RAS: Fix return value check in create_debugfs_nodes() | expand

Commit Message

Leizhen (ThunderTown) Oct. 23, 2024, 7:13 a.m. UTC
Fix the incorrect return value check for debugfs_create_dir() and
debugfs_create_file(), which returns ERR_PTR(-ERROR) instead of NULL
when it fails.

Fixes: 011d82611172 ("RAS: Add a Corrected Errors Collector")
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/ras/cec.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
index e440b15fbabccbb..fda289ef06105ba 100644
--- a/drivers/ras/cec.c
+++ b/drivers/ras/cec.c
@@ -489,21 +489,21 @@  static int __init create_debugfs_nodes(void)
 	}
 
 	d = debugfs_create_dir("cec", dfs);
-	if (!d) {
+	if (IS_ERR(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);
-	if (!decay) {
+	if (IS_ERR(decay)) {
 		pr_warn("Error creating decay_interval debugfs node!\n");
 		goto err;
 	}
 
 	count = debugfs_create_file("action_threshold", S_IRUSR | S_IWUSR, d,
 				    &action_threshold, &action_threshold_ops);
-	if (!count) {
+	if (IS_ERR(count)) {
 		pr_warn("Error creating action_threshold debugfs node!\n");
 		goto err;
 	}
@@ -512,13 +512,13 @@  static int __init create_debugfs_nodes(void)
 		return 0;
 
 	pfn = debugfs_create_file("pfn", S_IRUSR | S_IWUSR, d, &dfs_pfn, &pfn_ops);
-	if (!pfn) {
+	if (IS_ERR(pfn)) {
 		pr_warn("Error creating pfn debugfs node!\n");
 		goto err;
 	}
 
 	array = debugfs_create_file("array", S_IRUSR, d, NULL, &array_fops);
-	if (!array) {
+	if (IS_ERR(array)) {
 		pr_warn("Error creating array debugfs node!\n");
 		goto err;
 	}