Commit 9a5573e378c5c8976c6000a7643b52e2a0481688

Authored by Michael Ellerman
Committed by Paul Mackerras
1 parent 95920324f5

[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: Michael Ellerman <michael@ellerman.id.au>

 arch/ppc64/kernel/setup.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
Signed-off-by: Paul Mackerras <paulus@samba.org>

Showing 1 changed file with 12 additions and 8 deletions Side-by-side Diff

arch/ppc64/kernel/setup.c
... ... @@ -536,15 +536,19 @@
536 536  
537 537 DBG(" -> check_for_initrd()\n");
538 538  
539   - prop = (u64 *)get_property(of_chosen, "linux,initrd-start", NULL);
540   - if (prop != NULL) {
541   - initrd_start = (unsigned long)__va(*prop);
542   - prop = (u64 *)get_property(of_chosen, "linux,initrd-end", NULL);
  539 + if (of_chosen) {
  540 + prop = (u64 *)get_property(of_chosen,
  541 + "linux,initrd-start", NULL);
543 542 if (prop != NULL) {
544   - initrd_end = (unsigned long)__va(*prop);
545   - initrd_below_start_ok = 1;
546   - } else
547   - initrd_start = 0;
  543 + initrd_start = (unsigned long)__va(*prop);
  544 + prop = (u64 *)get_property(of_chosen,
  545 + "linux,initrd-end", NULL);
  546 + if (prop != NULL) {
  547 + initrd_end = (unsigned long)__va(*prop);
  548 + initrd_below_start_ok = 1;
  549 + } else
  550 + initrd_start = 0;
  551 + }
548 552 }
549 553  
550 554 /* If we were passed an initrd, set the ROOT_DEV properly if the values