Merge remote-tracking branch 'stable/linux-4.19.y' into rpi-4.19.y
[platform/kernel/linux-rpi.git] / arch / arm64 / kernel / armv8_deprecated.c
index 92be1d1..9d3442d 100644 (file)
@@ -177,15 +177,23 @@ static void __init register_insn_emulation(struct insn_emulation_ops *ops)
        struct insn_emulation *insn;
 
        insn = kzalloc(sizeof(*insn), GFP_KERNEL);
+       if (!insn)
+               return;
+
        insn->ops = ops;
        insn->min = INSN_UNDEF;
 
        switch (ops->status) {
        case INSN_DEPRECATED:
+#if 0
                insn->current_mode = INSN_EMULATE;
                /* Disable the HW mode if it was turned on at early boot time */
                run_all_cpu_set_hw_mode(insn, false);
+#else
+               insn->current_mode = INSN_HW;
+               run_all_cpu_set_hw_mode(insn, true);
                insn->max = INSN_HW;
+#endif
                break;
        case INSN_OBSOLETE:
                insn->current_mode = INSN_UNDEF;
@@ -236,6 +244,8 @@ static void __init register_insn_emulation_sysctl(void)
 
        insns_sysctl = kcalloc(nr_insn_emulated + 1, sizeof(*sysctl),
                               GFP_KERNEL);
+       if (!insns_sysctl)
+               return;
 
        raw_spin_lock_irqsave(&insn_emulation_lock, flags);
        list_for_each_entry(insn, &insn_emulation, node) {