arm64: add MTE supported check to thread switching and syscall entry/exit
[linux-2.6-microblaze.git] / arch / arm64 / kernel / mte.c
index 9d314a3..e5e801b 100644 (file)
@@ -142,12 +142,7 @@ void mte_enable_kernel_async(void)
 #ifdef CONFIG_KASAN_HW_TAGS
 void mte_check_tfsr_el1(void)
 {
-       u64 tfsr_el1;
-
-       if (!system_supports_mte())
-               return;
-
-       tfsr_el1 = read_sysreg_s(SYS_TFSR_EL1);
+       u64 tfsr_el1 = read_sysreg_s(SYS_TFSR_EL1);
 
        if (unlikely(tfsr_el1 & SYS_TFSR_EL1_TF1)) {
                /*
@@ -199,6 +194,9 @@ void mte_thread_init_user(void)
 
 void mte_thread_switch(struct task_struct *next)
 {
+       if (!system_supports_mte())
+               return;
+
        mte_update_sctlr_user(next);
 
        /*