Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a5573e3 authored by Michael Ellerman's avatar Michael Ellerman Committed by Paul Mackerras
Browse files

[PATCH] ppc64: Check of_chosen in check_for_initrd()



You can't call get_property() on a NULL node, so check if of_chosen is set
in check_for_initrd().

Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>

 arch/ppc64/kernel/setup.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 95920324
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -536,16 +536,20 @@ static void __init check_for_initrd(void)

	DBG(" -> check_for_initrd()\n");

	prop = (u64 *)get_property(of_chosen, "linux,initrd-start", NULL);
	if (of_chosen) {
		prop = (u64 *)get_property(of_chosen,
				"linux,initrd-start", NULL);
		if (prop != NULL) {
			initrd_start = (unsigned long)__va(*prop);
		prop = (u64 *)get_property(of_chosen, "linux,initrd-end", NULL);
			prop = (u64 *)get_property(of_chosen,
					"linux,initrd-end", NULL);
			if (prop != NULL) {
				initrd_end = (unsigned long)__va(*prop);
				initrd_below_start_ok = 1;
			} else
				initrd_start = 0;
		}
	}

	/* If we were passed an initrd, set the ROOT_DEV properly if the values
	 * look sensible. If not, clear initrd reference.