Skip to contentSkip to conversation

EDAC/altera: Fix error checking

PATCH Applied Yeqi Fu 2 participants 2 messages May 17, 2023 – Jun 7, 2023

Subsystems (2)
lore
Share & tools
lore

Yeqi Fu

author
#0 lore raw

PATCH 1/1 EDAC/altera: Fix error checking

The function edac_debugfs_create_dir returns ERR_PTR if an error occurs, and the appropriate way to verify for errors is to use the inline function IS_ERR. The patch will substitute the null-comparison with IS_ERR.

---
 drivers/edac/altera_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/altera_edac.c +1 -1
index 8b31cd54bdb6..19693333408f 100644
@@ -683,7 +683,7 @@ static void altr_create_edacdev_dbgfs(struct edac_device_ctl_info *edac_dci,
 		return;
 
 	drvdata->debugfs_dir = edac_debugfs_create_dir(drvdata->edac_dev_name);
-	if (!drvdata->debugfs_dir)
+	if (IS_ERR(drvdata->debugfs_dir))
 		return;
 
 	if (!edac_debugfs_create_file("altr_trigger", S_IWUSR,
Signature · 1 line
2.37.2
maintainer Applied
#1 lore raw
Quoted 16 lines · Yeqi Fu

The function edac_debugfs_create_dir returns ERR_PTR if an error occurs, and the appropriate way to verify for errors is to use the inline function IS_ERR. The patch will substitute the null-comparison with IS_ERR.

---
 drivers/edac/altera_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/altera_edac.c +0 -0
index 8b31cd54bdb6..19693333408f 100644

drivers/edac/altera_edac.c static void altr_create_edacdev_dbgfs(struct edac_device_ctl_info *edac_dci, · line 689

Quoted 8 lines
drivers/edac/altera_edac.c +1 -1
@@ -683,7 +683,7 @@ static void altr_create_edacdev_dbgfs(struct edac_device_ctl_info *edac_dci,
 		return;
 
 	drvdata->debugfs_dir = edac_debugfs_create_dir(drvdata->edac_dev_name);
-	if (!drvdata->debugfs_dir)
+	if (IS_ERR(drvdata->debugfs_dir))
 		return;
 
 	if (!edac_debugfs_create_file("altr_trigger", S_IWUSR,

Applied, thanks.

Signature · 4 lines
Regards/Gruss,
    Boris.

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