Skip to contentSkip to conversation

fdt: Remove duplicate code

PATCH New Thierry Reding 2 participants 2 messages Mar 1, 2019 – Mar 10, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fdt: Remove duplicate code

From: Thierry Reding <[email protected]>

Commit 6d29cc7dcf2d ("fdt: Fixup only valid memory banks") ended up being merged twice, first as:

commit 6d29cc7dcf2d35966aa0b6119fd1cbca0d21d5e6
Author: Thierry Reding <[email protected]>
AuthorDate: Tue Jan 30 11:34:17 2018 +0100
Commit: Simon Glass <[email protected]>
CommitDate: Sun Feb 18 12:53:38 2018 -0700

fdt: Fixup only valid memory banks

Memory banks with address 0 and size 0 are empty and should not be passed to the OS via device tree.

and later again, though this time it was v2:

commit ed5af03f9bb8905f1e94d68ab49f22d7f061d75f
Author: Thierry Reding <[email protected]>
AuthorDate: Thu Feb 15 19:05:59 2018 +0100
Commit: Tom Rini <[email protected]>
CommitDate: Fri Feb 23 10:40:50 2018 -0500

fdt: Fixup only valid memory banks

Memory banks with address 0 and size 0 are empty and should not be passed to the OS via device tree.

The second version was slightly different, so the main hunk of the patch was applied twice. This isn't harmful because the code is idempotent, but it's wasteful to run the same code twice.

---
 common/fdt_support.c | 6 ------
 1 file changed, 6 deletions(-)
common/fdt_support.c +0 -6
index 42583e3ed8c8..ab08a0114fee 100644
@@ -456,12 +456,6 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
 	if (!banks)
 		return 0;
 
-	for (i = 0; i < banks; i++)
-		if (start[i] == 0 && size[i] == 0)
-			break;
-
-	banks = i;
-
 	len = fdt_pack_reg(blob, tmp, start, size, banks);
 
 	err = fdt_setprop(blob, nodeoffset, "reg", tmp, len);
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 fdt: Remove duplicate code

Quoted 36 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Commit 6d29cc7dcf2d ("fdt: Fixup only valid memory banks") ended up being merged twice, first as:

commit 6d29cc7dcf2d35966aa0b6119fd1cbca0d21d5e6
Author: Thierry Reding <[email protected]>
AuthorDate: Tue Jan 30 11:34:17 2018 +0100
Commit: Simon Glass <[email protected]>
CommitDate: Sun Feb 18 12:53:38 2018 -0700

fdt: Fixup only valid memory banks

Memory banks with address 0 and size 0 are empty and should not be passed to the OS via device tree.

and later again, though this time it was v2:

commit ed5af03f9bb8905f1e94d68ab49f22d7f061d75f
Author: Thierry Reding <[email protected]>
AuthorDate: Thu Feb 15 19:05:59 2018 +0100
Commit: Tom Rini <[email protected]>
CommitDate: Fri Feb 23 10:40:50 2018 -0500

fdt: Fixup only valid memory banks

Memory banks with address 0 and size 0 are empty and should not be passed to the OS via device tree.

Quoted 8 lines

The second version was slightly different, so the main hunk of the patch was applied twice. This isn't harmful because the code is idempotent, but it's wasteful to run the same code twice.

---
 common/fdt_support.c | 6 ------
 1 file changed, 6 deletions(-)