Skip to contentSkip to conversation

drivers: edac: zynqmp_edac: Updates return value check

PATCH In review Atul Kumar Pant 2 participants 5 messages Aug 6, 2023 – Aug 15, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: edac: zynqmp_edac: Updates return value check

Updating the check of return value from edac_debugfs_create_dir to use IS_ERR.

---
 drivers/edac/zynqmp_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/zynqmp_edac.c +1 -1
index ac7d1e0b324c..cefbbafb945e 100644
@@ -351,7 +351,7 @@ static void setup_debugfs(struct edac_device_ctl_info *edac_dev)
 	struct edac_priv *priv = edac_dev->pvt_info;
 
 	priv->debugfs_dir = edac_debugfs_create_dir("ocm");
-	if (!priv->debugfs_dir)
+	if (IS_ERR(priv->debugfs_dir))
 		return;
 
 	edac_debugfs_create_x32("inject_fault_count", 0644, priv->debugfs_dir,
Signature · 1 line
2.25.1
#1 lore raw
Quoted 13 lines · Atul Kumar Pant

Updating the check of return value from edac_debugfs_create_dir to use IS_ERR.

---
 drivers/edac/zynqmp_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/zynqmp_edac.c +0 -0
index ac7d1e0b324c..cefbbafb945e 100644

drivers/edac/zynqmp_edac.c static void setup_debugfs(struct edac_device_ctl_info *edac_dev) · line 355

Quoted 6 lines
drivers/edac/zynqmp_edac.c +1 -1
@@ -351,7 +351,7 @@ static void setup_debugfs(struct edac_device_ctl_info *edac_dev)
 	struct edac_priv *priv = edac_dev->pvt_info;
 
 	priv->debugfs_dir = edac_debugfs_create_dir("ocm");
-	if (!priv->debugfs_dir)
+	if (IS_ERR(priv->debugfs_dir))
 		return;

Again, not correct, sorry. Please do not make these types of changes.

Why do you feel this is needed at all?

thanks,

greg k-h

#2 lore raw
Quoted 16 lines · Greg KH
Quoted 15 lines · Atul Kumar Pant

Updating the check of return value from edac_debugfs_create_dir to use IS_ERR.

---
 drivers/edac/zynqmp_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/zynqmp_edac.c +0 -0
index ac7d1e0b324c..cefbbafb945e 100644
@@ -351,7 +351,7 @@ static void setup_debugfs(struct edac_device_ctl_info *edac_dev)
 	struct edac_priv *priv = edac_dev->pvt_info;
 
Quoted 9 lines

drivers/edac/zynqmp_edac.c static void setup_debugfs(struct edac_device_ctl_info *edac_dev) · line 355

Quoted 4 lines
drivers/edac/zynqmp_edac.c +1 -1
 	priv->debugfs_dir = edac_debugfs_create_dir("ocm");
-	if (!priv->debugfs_dir)
+	if (IS_ERR(priv->debugfs_dir))
 		return;

Again, not correct, sorry. Please do not make these types of changes.

Why do you feel this is needed at all?

edac_debugfs_create_dir uses debugfs_create_dir that return ERR_PTR. Hence to check the return value by this function I changed null comparison with IS_ERR.

Quoted 3 lines

thanks,

greg k-h

#3 lore raw
Quoted 24 lines · Atul Kumar Pant
Quoted 23 lines · Greg KH
Quoted 13 lines · Atul Kumar Pant

Updating the check of return value from edac_debugfs_create_dir to use IS_ERR.

---
 drivers/edac/zynqmp_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/zynqmp_edac.c +0 -0
index ac7d1e0b324c..cefbbafb945e 100644

drivers/edac/zynqmp_edac.c static void setup_debugfs(struct edac_device_ctl_info *edac_dev) · line 355

Quoted 6 lines
drivers/edac/zynqmp_edac.c +1 -1
@@ -351,7 +351,7 @@ static void setup_debugfs(struct edac_device_ctl_info *edac_dev)
 	struct edac_priv *priv = edac_dev->pvt_info;
 
 	priv->debugfs_dir = edac_debugfs_create_dir("ocm");
-	if (!priv->debugfs_dir)
+	if (IS_ERR(priv->debugfs_dir))
 		return;

Again, not correct, sorry. Please do not make these types of changes.

Quoted 5 lines
Quoted 2 lines

Why do you feel this is needed at all?

edac_debugfs_create_dir uses debugfs_create_dir that return ERR_PTR. Hence to check the return value by this function I changed null comparison with IS_ERR.

But that's not needed at all, right?

As this check has not ever really worked, why check it at all?

greg k-h

#4 lore raw
Quoted 27 lines · Greg KH
Quoted 26 lines · Atul Kumar Pant
Quoted 25 lines · Greg KH
Quoted 13 lines · Atul Kumar Pant

Updating the check of return value from edac_debugfs_create_dir to use IS_ERR.

---
 drivers/edac/zynqmp_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/zynqmp_edac.c +0 -0
index ac7d1e0b324c..cefbbafb945e 100644

drivers/edac/zynqmp_edac.c static void setup_debugfs(struct edac_device_ctl_info *edac_dev) · line 355

Quoted 6 lines
drivers/edac/zynqmp_edac.c +1 -1
@@ -351,7 +351,7 @@ static void setup_debugfs(struct edac_device_ctl_info *edac_dev)
 	struct edac_priv *priv = edac_dev->pvt_info;
 
 	priv->debugfs_dir = edac_debugfs_create_dir("ocm");
-	if (!priv->debugfs_dir)
+	if (IS_ERR(priv->debugfs_dir))
 		return;

Again, not correct, sorry. Please do not make these types of changes.

Why do you feel this is needed at all?

Quoted 7 lines
Quoted 3 lines

edac_debugfs_create_dir uses debugfs_create_dir that return ERR_PTR. Hence to check the return value by this function I changed null comparison with IS_ERR.

But that's not needed at all, right?

As this check has not ever really worked, why check it at all?

I'll fix this in a new patch

Quoted 2 lines

greg k-h

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees