diff mbox

[U-Boot,v2,9/9] fdt_support: correct the return condition of fdt_initrd()

Message ID 1397810465-10006-10-git-send-email-yamada.m@jp.panasonic.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Masahiro Yamada April 18, 2014, 8:41 a.m. UTC
Before this commit, fdt_initrd() just returned if initrd
start address is zero.
But it is possible if the RAM is located at address 0.

This commit makes the return condition more reasonable:
Just return if the size of initrd is zero.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

Changes in v2: None

 common/fdt_support.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Simon Glass May 24, 2014, 1:29 a.m. UTC | #1
On 17 April 2014 22:41, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:
> Before this commit, fdt_initrd() just returned if initrd
> start address is zero.
> But it is possible if the RAM is located at address 0.
>
> This commit makes the return condition more reasonable:
> Just return if the size of initrd is zero.
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

Acked-by: Simon Glass <sjg@chromium.org>

> ---
>
> Changes in v2: None
>
>  common/fdt_support.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
Tom Rini June 19, 2014, 3:21 p.m. UTC | #2
On Fri, Apr 18, 2014 at 05:41:05PM +0900, Masahiro Yamada wrote:

> Before this commit, fdt_initrd() just returned if initrd
> start address is zero.
> But it is possible if the RAM is located at address 0.
> 
> This commit makes the return condition more reasonable:
> Just return if the size of initrd is zero.
> 
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 5631f16..89119be 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -191,15 +191,15 @@  int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end)
 	int is_u64;
 	uint64_t addr, size;
 
+	/* just return if the size of initrd is zero */
+	if (initrd_start == initrd_end)
+		return 0;
+
 	/* find or create "/chosen" node. */
 	nodeoffset = fdt_find_or_add_subnode(fdt, 0, "chosen");
 	if (nodeoffset < 0)
 		return nodeoffset;
 
-	/* just return if initrd_start/end aren't valid */
-	if ((initrd_start == 0) || (initrd_end == 0))
-		return 0;
-
 	total = fdt_num_mem_rsv(fdt);
 
 	/*