[tglx-devel:x86/fpu-kvm 88/88] arch/x86/kernel/fpu/core.c:281:6: warning: variable 'ret' set but not used

From: kernel test robot
Date: Sun Oct 17 2021 - 16:26:10 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git x86/fpu-kvm
head: dc3cd5721cdb0d3116a2feb84755427d1522477a
commit: dc3cd5721cdb0d3116a2feb84755427d1522477a [88/88] x86/fpu: Add reallocation mechanims for KVM
config: x86_64-randconfig-r031-20211017 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 746dd6a700931988dd9021d3d04718f1929885a5)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git/commit/?id=dc3cd5721cdb0d3116a2feb84755427d1522477a
git remote add tglx-devel https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git
git fetch --no-tags tglx-devel x86/fpu-kvm
git checkout dc3cd5721cdb0d3116a2feb84755427d1522477a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> arch/x86/kernel/fpu/core.c:281:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
int ret;
^
1 warning generated.


vim +/ret +281 arch/x86/kernel/fpu/core.c

275
276 int fpu_swap_kvm_fpstate(struct fpu_guest *guest_fpu, bool enter_guest,
277 u64 restore_mask)
278 {
279 struct fpstate *guest_fps, *cur_fps;
280 struct fpu *fpu = &current->thread.fpu;
> 281 int ret;
282
283 if (unlikely(guest_fpu->realloc_request))
284 ret = fpu_guest_realloc_fpstate(guest_fpu, enter_guest);
285
286 guest_fps = guest_fpu->fpstate;
287 cur_fps = fpu->fpstate;
288
289 fpregs_lock();
290 if (!cur_fps->is_confidential && !test_thread_flag(TIF_NEED_FPU_LOAD))
291 save_fpregs_to_fpstate(fpu);
292
293 /* Swap fpstate */
294 if (enter_guest) {
295 fpu->__task_fpstate = cur_fps;
296 fpu->fpstate = guest_fps;
297 guest_fps->in_use = true;
298 } else {
299 guest_fps->in_use = false;
300 fpu->fpstate = fpu->__task_fpstate;
301 fpu->__task_fpstate = NULL;
302 }
303
304 cur_fps = fpu->fpstate;
305
306 if (!cur_fps->is_confidential) {
307 restore_mask &= XFEATURE_MASK_FPSTATE;
308 /* Includes XFD update */
309 restore_fpregs_from_fpstate(cur_fps, restore_mask);
310 } else {
311 /*
312 * XSTATE is restored by firmware from encrypted
313 * memory. Make sure XFD state is correct while
314 * running with guest fpstate
315 */
316 xfd_update_state(cur_fps);
317 }
318
319 fpregs_mark_activate();
320 fpregs_unlock();
321 return 0;
322 }
323 EXPORT_SYMBOL_GPL(fpu_swap_kvm_fpstate);
324

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip