* Try to dedicate one of the protection keys to be used as an
  * execute-only protection key.
  */
-extern int __execute_only_pkey(struct mm_struct *mm);
-static inline int execute_only_pkey(struct mm_struct *mm)
-{
-       if (static_branch_likely(&pkey_disabled))
-               return -1;
-
-       return __execute_only_pkey(mm);
-}
-
+extern int execute_only_pkey(struct mm_struct *mm);
 extern int __arch_override_mprotect_pkey(struct vm_area_struct *vma,
                                         int prot, int pkey);
 static inline int arch_override_mprotect_pkey(struct vm_area_struct *vma,
 
 /* Bits set for the initially allocated keys */
 static u32 initial_allocation_mask __ro_after_init;
 
-static bool pkey_execute_disable_supported;
 /*
  * Even if we allocate keys with sys_pkey_alloc(), we need to make sure
  * other thread still find the access denied using the same keys.
  * We pick key 2 because 0 is special key and 1 is reserved as per ISA.
  */
 static int execute_only_key = 2;
+static bool pkey_execute_disable_supported;
 
 
 #define AMR_BITS_PER_PKEY 2
        num_pkey = pkeys_total;
 #endif
 
-       if (unlikely(num_pkey <= execute_only_key)) {
+       if (unlikely(num_pkey <= execute_only_key) || !pkey_execute_disable_supported) {
                /*
                 * Insufficient number of keys to support
                 * execute only key. Mark it unavailable.
        write_uamor(default_uamor);
 }
 
-int __execute_only_pkey(struct mm_struct *mm)
+int execute_only_pkey(struct mm_struct *mm)
 {
        return mm->context.execute_only_pkey;
 }