]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/powerpc/kernel/fadump.c
powerpc: Correct DSCR during TM context switch
[karo-tx-linux.git] / arch / powerpc / kernel / fadump.c
index 2230fd0ca3e4fc089931f25a61c20cb66aa99a6a..742694c1d85238fe380e4ceecd7443506bb8d0b7 100644 (file)
@@ -55,9 +55,9 @@ int crash_mem_ranges;
 int __init early_init_dt_scan_fw_dump(unsigned long node,
                        const char *uname, int depth, void *data)
 {
-       __be32 *sections;
+       const __be32 *sections;
        int i, num_sections;
-       unsigned long size;
+       int size;
        const int *token;
 
        if (depth != 1 || strcmp(uname, "rtas") != 0)
@@ -69,7 +69,7 @@ int __init early_init_dt_scan_fw_dump(unsigned long node,
         */
        token = of_get_flat_dt_prop(node, "ibm,configure-kernel-dump", NULL);
        if (!token)
-               return 0;
+               return 1;
 
        fw_dump.fadump_supported = 1;
        fw_dump.ibm_configure_kernel_dump = *token;
@@ -92,7 +92,7 @@ int __init early_init_dt_scan_fw_dump(unsigned long node,
                                        &size);
 
        if (!sections)
-               return 0;
+               return 1;
 
        num_sections = size / (3 * sizeof(u32));
 
@@ -110,6 +110,7 @@ int __init early_init_dt_scan_fw_dump(unsigned long node,
                        break;
                }
        }
+
        return 1;
 }
 
@@ -645,7 +646,7 @@ static int __init fadump_build_cpu_notes(const struct fadump_mem_struct *fdm)
                }
                /* Lower 4 bytes of reg_value contains logical cpu id */
                cpu = reg_entry->reg_value & FADUMP_CPU_ID_MASK;
-               if (!cpumask_test_cpu(cpu, &fdh->cpu_online_mask)) {
+               if (fdh && !cpumask_test_cpu(cpu, &fdh->cpu_online_mask)) {
                        SKIP_TO_NEXT_CPU(reg_entry);
                        continue;
                }
@@ -662,9 +663,11 @@ static int __init fadump_build_cpu_notes(const struct fadump_mem_struct *fdm)
        }
        fadump_final_note(note_buf);
 
-       pr_debug("Updating elfcore header (%llx) with cpu notes\n",
+       if (fdh) {
+               pr_debug("Updating elfcore header (%llx) with cpu notes\n",
                                                        fdh->elfcorehdr_addr);
-       fadump_update_elfcore_header((char *)__va(fdh->elfcorehdr_addr));
+               fadump_update_elfcore_header((char *)__va(fdh->elfcorehdr_addr));
+       }
        return 0;
 
 error_out: