[openeuler:openEuler-1.0-LTS 1636/1636] arch/x86/kernel/fpu/core.c:175:14: warning: mixing declarations and code is a C99 extension

tree: https://gitee.com/openeuler/kernel.git openEuler-1.0-LTS head: 60611bd206ba7e11ef429b2653fdada76eff4d77 commit: 1e3cb18ebe2976b3294e85c3d162736cc3c7c92b [1636/1636] x86: Enhanced copy capabilities for Hygon processor config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20250516/202505160438.vuslIGAx-lkp@i...) compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250516/202505160438.vuslIGAx-lkp@i...) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202505160438.vuslIGAx-lkp@intel.com/ All warnings (new ones prefixed by >>): arch/x86/kernel/fpu/core.c:149:14: warning: no previous prototype for function 'get_fpustate_free_space' [-Wmissing-prototypes] 149 | unsigned int get_fpustate_free_space(struct fpu *fpu) | ^ arch/x86/kernel/fpu/core.c:149:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 149 | unsigned int get_fpustate_free_space(struct fpu *fpu) | ^ | static
arch/x86/kernel/fpu/core.c:175:14: warning: mixing declarations and code is a C99 extension [-Wdeclaration-after-statement] 175 | struct fpu *fpu = ¤t->thread.fpu; | ^ 2 warnings generated.
vim +175 arch/x86/kernel/fpu/core.c 144 145 #if defined(CONFIG_X86_HYGON_LMC_SSE2_ON) || \ 146 defined(CONFIG_X86_HYGON_LMC_AVX2_ON) 147 148 extern unsigned int fpu_kernel_nonatomic_xstate_size;
149 unsigned int get_fpustate_free_space(struct fpu *fpu) 150 { 151 if ((fpu_kernel_xstate_size + fpu_kernel_nonatomic_xstate_size) > 152 sizeof(fpu->state)) 153 return 0; 154 return fpu_kernel_nonatomic_xstate_size; 155 } 156 157 unsigned long get_fpu_registers_pos(struct fpu *fpu, unsigned int off) 158 { 159 unsigned long addr = 0; 160 161 if (fpu && (fpu_kernel_nonatomic_xstate_size > off)) { 162 addr = (unsigned long)&fpu->state.__padding[0]; 163 addr += fpu_kernel_xstate_size + off; 164 } 165 return addr; 166 } 167 168 /* 169 * We can call kernel_fpu_begin_nonatomic in non-atomic task context. 170 */ 171 int kernel_fpu_begin_nonatomic_mask(void) 172 { 173 preempt_disable(); 174 175 struct fpu *fpu = ¤t->thread.fpu; 176 177 /* we not support Nested call */ 178 if (test_thread_flag(TIF_USING_FPU_NONATOMIC)) 179 goto err; 180 181 if (KERNEL_FPU_NONATOMIC_SIZE > 182 get_fpustate_free_space(¤t->thread.fpu)) 183 goto err; 184 185 /* 186 * This means we call kernel_fpu_begin_nonatomic after kernel_fpu_begin, 187 * but before kernel_fpu_end. 188 */ 189 if (this_cpu_read(in_kernel_fpu)) 190 goto err; 191 192 if (in_interrupt()) 193 goto err; 194 195 if (current->flags & PF_KTHREAD) 196 goto err; 197 198 if (fpu->initialized) 199 copy_fpregs_to_fpstate(¤t->thread.fpu); 200 201 /* Set thread flag: TIC_USING_FPU_NONATOMIC */ 202 set_thread_flag(TIF_USING_FPU_NONATOMIC); 203 204 __cpu_invalidate_fpregs_state(); 205 206 preempt_enable(); 207 208 return 0; 209 210 err: 211 preempt_enable(); 212 213 return -1; 214 } 215 EXPORT_SYMBOL_GPL(kernel_fpu_begin_nonatomic_mask); 216
-- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
participants (1)
-
kernel test robot