Skip to contentSkip to conversation

EDAC/aspeed: do not fail probe when ECC is disabled

PATCH Superseded Eric Yun Lin Chiang 3 participants 4 messages Nov 18 – Dec 1

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 EDAC/aspeed: do not fail probe when ECC is disabled

The AST2600 memory-controller EDAC node is enabled by default in aspeed-g6.dtsi (it has no status property), so aspeed_edac binds on every AST2600 board. aspeed_probe() reads the memory-controller configuration and, when DRAM ECC was not turned on by firmware, prints an error and returns -EPERM:

aspeed-edac 1e6e0000.sdram: ECC mode is not configured in u-boot aspeed-edac 1e6e0000.sdram: probe with driver aspeed-edac failed with error -1

Running without DRAM ECC is a normal platform choice, not a failure. -EPERM is both the wrong errno (this is not a permission problem) and one the driver core reports as a probe error, so every non-ECC AST2600 board logs a spurious "failed with error -1" at boot.

Return -ENODEV instead, which the driver core treats as "no device to bind" and does not log as an error, and lower the message to dev_info so the reason EDAC did not register is still visible once without looking like a fault. The AST2500 node is disabled by default, so only boards that explicitly enable it are affected there. No other error path is changed.

This change was prepared with the help of an AI coding assistant, which analysed the probe path and drafted this changelog; the author has reviewed it and stands behind the change.

Fixes 9b7e6242ee4e ("EDAC, aspeed: Add an Aspeed AST2500 EDAC driver")

---
Tested: the pre-fix "failed with error -1" was reproduced on an AST2600 (Facebook Bletchley) BMC by triggering the aspeed-edac probe over sysfs; the fixed driver builds (W=1, no new warnings) and passes checkpatch, and the resulting behaviour -- aspeed_probe() now returns -ENODEV, which the driver core does not log as an error -- was confirmed by disassembly of the built object. NOT boot-tested on hardware (the kernel was not booted).

 drivers/edac/aspeed_edac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/edac/aspeed_edac.c +2 -2
index 6e069b255..e6f8cf78a 100644
@@ -295,8 +295,8 @@ static int aspeed_probe(struct platform_device *pdev)
 	/* bail out if ECC mode is not configured */
 	regmap_read(aspeed_regmap, ASPEED_MCR_CONF, &reg04);
 	if (!(reg04 & ASPEED_MCR_CONF_ECC)) {
-		dev_err(&pdev->dev, "ECC mode is not configured in u-boot\n");
-		return -EPERM;
+		dev_info(&pdev->dev, "ECC mode is not configured in u-boot\n");
+		return -ENODEV;
 	}
 
 	edac_op_state = EDAC_OPSTATE_INT;
Signature · 1 line
2.53.0
maintainer
#1 lore raw

Ryan?

Quoted 58 lines · Eric Yun Lin Chiang

The AST2600 memory-controller EDAC node is enabled by default in aspeed-g6.dtsi (it has no status property), so aspeed_edac binds on every AST2600 board. aspeed_probe() reads the memory-controller configuration and, when DRAM ECC was not turned on by firmware, prints an error and returns -EPERM:

aspeed-edac 1e6e0000.sdram: ECC mode is not configured in u-boot aspeed-edac 1e6e0000.sdram: probe with driver aspeed-edac failed with error -1

Running without DRAM ECC is a normal platform choice, not a failure. -EPERM is both the wrong errno (this is not a permission problem) and one the driver core reports as a probe error, so every non-ECC AST2600 board logs a spurious "failed with error -1" at boot.

Return -ENODEV instead, which the driver core treats as "no device to bind" and does not log as an error, and lower the message to dev_info so the reason EDAC did not register is still visible once without looking like a fault. The AST2500 node is disabled by default, so only boards that explicitly enable it are affected there. No other error path is changed.

This change was prepared with the help of an AI coding assistant, which analysed the probe path and drafted this changelog; the author has reviewed it and stands behind the change.

Fixes 9b7e6242ee4e ("EDAC, aspeed: Add an Aspeed AST2500 EDAC driver")

---
Tested: the pre-fix "failed with error -1" was reproduced on an AST2600 (Facebook Bletchley) BMC by triggering the aspeed-edac probe over sysfs; the fixed driver builds (W=1, no new warnings) and passes checkpatch, and the resulting behaviour -- aspeed_probe() now returns -ENODEV, which the driver core does not log as an error -- was confirmed by disassembly of the built object. NOT boot-tested on hardware (the kernel was not booted).

 drivers/edac/aspeed_edac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/edac/aspeed_edac.c +2 -2
index 6e069b255..e6f8cf78a 100644
@@ -295,8 +295,8 @@ static int aspeed_probe(struct platform_device *pdev)
 	/* bail out if ECC mode is not configured */
 	regmap_read(aspeed_regmap, ASPEED_MCR_CONF, &reg04);
 	if (!(reg04 & ASPEED_MCR_CONF_ECC)) {
-		dev_err(&pdev->dev, "ECC mode is not configured in u-boot\n");
-		return -EPERM;
+		dev_info(&pdev->dev, "ECC mode is not configured in u-boot\n");
+		return -ENODEV;
 	}
 
 	edac_op_state = EDAC_OPSTATE_INT;
Signature · 1 line
2.53.0
Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
reviewer
#2 lore raw
Quoted 3 lines

Subject: Re: [PATCH] EDAC/aspeed: do not fail probe when ECC is disabled

Ryan?

Yes, give me more time to look at this ~

Quoted 69 lines · Eric Yun Lin Chiang

drivers/edac/aspeed_edac.c static int aspeed_probe(struct platform_device

Quoted 46 lines

The AST2600 memory-controller EDAC node is enabled by default in aspeed-g6.dtsi (it has no status property), so aspeed_edac binds on every AST2600 board. aspeed_probe() reads the memory-controller configuration and, when DRAM ECC was not turned on by firmware, prints an error and returns -EPERM:

aspeed-edac 1e6e0000.sdram: ECC mode is not configured in u-boot aspeed-edac 1e6e0000.sdram: probe with driver aspeed-edac failed
with error -1

Running without DRAM ECC is a normal platform choice, not a failure. -EPERM is both the wrong errno (this is not a permission problem) and one the driver core reports as a probe error, so every non-ECC AST2600 board logs a spurious "failed with error -1" at boot.

Return -ENODEV instead, which the driver core treats as "no device to bind" and does not log as an error, and lower the message to dev_info so the reason EDAC did not register is still visible once without looking like a fault. The AST2500 node is disabled by default, so only boards that explicitly enable it are affected there. No other error path is changed.

This change was prepared with the help of an AI coding assistant, which analysed the probe path and drafted this changelog; the author has reviewed it and stands behind the change.

Fixes 9b7e6242ee4e ("EDAC, aspeed: Add an Aspeed AST2500 EDAC

driver")

---
Tested: the pre-fix "failed with error -1" was reproduced on an AST2600 (Facebook Bletchley) BMC by triggering the aspeed-edac probe over sysfs; the fixed driver builds (W=1, no new warnings) and passes checkpatch, and the resulting behaviour -- aspeed_probe() now returns -ENODEV, which the driver core does not log as an error -- was confirmed by disassembly of the built object. NOT boot-tested on hardware (the kernel was not booted).

 drivers/edac/aspeed_edac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/edac/aspeed_edac.c +0 -0
index 6e069b255..e6f8cf78a 100644
@@ -295,8 +295,8 @@ static int aspeed_probe(struct platform_device

*pdev)

Quoted 11 lines
drivers/edac/aspeed_edac.c +2 -3
 	/* bail out if ECC mode is not configured */
 	regmap_read(aspeed_regmap, ASPEED_MCR_CONF, &reg04);
 	if (!(reg04 & ASPEED_MCR_CONF_ECC)) {
-		dev_err(&pdev->dev, "ECC mode is not configured in u-boot\n");
-		return -EPERM;
+		dev_info(&pdev->dev, "ECC mode is not configured in u-boot\n");
+		return -ENODEV;
 	}
 
 	edac_op_state = EDAC_OPSTATE_INT;
--
Quoted 3 lines

2.53.0

--
Regards/Gruss,
Boris.

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

reviewer
#3 lore raw
In reply to Eric Yun Lin Chiang
Quoted 23 lines

Subject: [PATCH] EDAC/aspeed: do not fail probe when ECC is disabled

The AST2600 memory-controller EDAC node is enabled by default in aspeed-g6.dtsi (it has no status property), so aspeed_edac binds on every AST2600 board. aspeed_probe() reads the memory-controller configuration and, when DRAM ECC was not turned on by firmware, prints an error and returns -EPERM:

aspeed-edac 1e6e0000.sdram: ECC mode is not configured in u-boot aspeed-edac 1e6e0000.sdram: probe with driver aspeed-edac failed with
error -1

Running without DRAM ECC is a normal platform choice, not a failure. -EPERM is both the wrong errno (this is not a permission problem) and one the driver core reports as a probe error, so every non-ECC AST2600 board logs a spurious "failed with error -1" at boot.

Return -ENODEV instead, which the driver core treats as "no device to bind" and does not log as an error, and lower the message to dev_info so the reason EDAC did not register is still visible once without looking like a fault. The AST2500 node is disabled by default, so only boards that explicitly enable it are affected there. No other error path is changed.

Quoted 4 lines

This change was prepared with the help of an AI coding assistant, which analysed the probe path and drafted this changelog; the author has reviewed it and stands behind the change.

Agreed, -EPERM is the wrong error here and the extra "failed with error -1" line on every non-ECC AST2600 is just noise.

A few comments on the patch itself:
- The changelog is long for a two-line change. Saying that a board without ECC is a normal setup and that -ENODEV keeps the driver core quiet is enough; there is no need to walk through the probe path.
- The note about the AI assistant belongs below the --- line, not in the commit message.

Quoted 30 lines
Fixes 9b7e6242ee4e ("EDAC, aspeed: Add an Aspeed AST2500 EDAC driver")

---
Tested: the pre-fix "failed with error -1" was reproduced on an AST2600 (Facebook Bletchley) BMC by triggering the aspeed-edac probe over sysfs; the fixed driver builds (W=1, no new warnings) and passes checkpatch, and the resulting behaviour -- aspeed_probe() now returns -ENODEV, which the driver core does not log as an error -- was confirmed by disassembly of the built object. NOT boot-tested on hardware (the kernel was not booted).

 drivers/edac/aspeed_edac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/edac/aspeed_edac.c index renamed from drivers/edac/aspeed_edac.c +0 -0

6e069b255..e6f8cf78a 100644

drivers/edac/aspeed_edac.c +2 -3
@@ -295,8 +295,8 @@ static int aspeed_probe(struct platform_device *pdev)
 	/* bail out if ECC mode is not configured */
 	regmap_read(aspeed_regmap, ASPEED_MCR_CONF, &reg04);
 	if (!(reg04 & ASPEED_MCR_CONF_ECC)) {
-		dev_err(&pdev->dev, "ECC mode is not configured in u-boot\n");
-		return -EPERM;
+		dev_info(&pdev->dev, "ECC mode is not configured in u-boot\n");
+		return -ENODEV;
 	}
 
 	edac_op_state = EDAC_OPSTATE_INT;
--

2.53.0