Skip to contentSkip to conversation

ram: k3-ddrss: fix ecc range checking bug

PATCH In review Bin Liu 3 participants 3 messages Jul 16 – Jul 28

lore
Share & tools
lore

Bin Liu

author
#0 lore raw

PATCH 1/1 ram: k3-ddrss: fix ecc range checking bug

The original checking is wrong, it basically compares memory address

    end = r->start + r->range;

with memory size:

    if (end > (ddr_ram_size - ecc_res))

so the if() condition would be always true. This causes the ECC config never take input from the devicetree.

Fixes f43f71012254 ("ram: k3-ddrss: Add support for a partial inline ECC region")
---
 drivers/ram/k3-ddrss/k3-ddrss.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/ram/k3-ddrss/k3-ddrss.c +1 -2
index 5144470b9313..c406998b20aa 100644
@@ -931,11 +931,10 @@ static int k3_ddrss_probe(struct udevice *dev)
 			struct k3_ddrss_ecc_region *r = range;
 
 			for (int i = 0; (i < K3_DDRSS_MAX_ECC_REG) && (r->range != 0); i++, r++) {
-				end = r->start + r->range;
 				ddr_ram_size = ddrss->ddr_ram_size;
 				ecc_res = ddrss->ecc_reserved_space;
 
-				if (end > (ddr_ram_size - ecc_res))
+				if (r->range > (ddr_ram_size - ecc_res))
 					ddrss->ecc_regions[i].range = ddr_ram_size - ecc_res;
 				else
 					ddrss->ecc_regions[i].range = r->range;
Signature · 1 line
2.34.1
#2 lore raw
In reply to Bin Liu
Quoted 9 lines · Bin Liu

The original checking is wrong, it basically compares memory address

    end = r->start + r->range;

with memory size:

    if (end > (ddr_ram_size - ecc_res))

[...]

Applied to u-boot/main, thanks!

[1/1] ram: k3-ddrss: fix ecc range checking bug

      commit: 616c3d79f01cf9204e38738857c4647a730dcb3b
Signature · 1 line
Tom