Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Xu Yilun <yilun.xu@linux.intel.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [intel-tdx:tdisp_phase1 27/36] drivers/virt/coco/tdx-host/tdx-host.c:221:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true
Date: Thu, 22 Oct 2026 07:03:20 +0800	[thread overview]
Message-ID: <202610220625.gi2GBN5M-lkp@intel.com> (raw)

tree:   https://github.com/intel/tdx.git tdisp_phase1
head:   245a83bdc025dc14a325b3c38b8a3bca2c631a9f
commit: e7c2aebf7644b84aca8e6fe98a67ca25af0a5b59 [27/36] coco/tdx-host: Establish an SPDM session with the device
config: x86_64-allmodconfig (https://download.01.org/0day-ci/archive/20261022/202610220625.gi2GBN5M-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
rustc: rustc 1.96.0 (ac68faa20 2026-05-25)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261022/202610220625.gi2GBN5M-lkp@intel.com/reproduce)

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/202610220625.gi2GBN5M-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/virt/coco/tdx-host/tdx-host.c:221:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
     221 |         if (!out_msg_page)
         |             ^~~~~~~~~~~~~
   drivers/virt/coco/tdx-host/tdx-host.c:243:9: note: uninitialized use occurs here
     243 |         return ret;
         |                ^~~
   drivers/virt/coco/tdx-host/tdx-host.c:221:2: note: remove the 'if' if its condition is always false
     221 |         if (!out_msg_page)
         |         ^~~~~~~~~~~~~~~~~~
     222 |                 goto out_free_in_msg;
         |                 ~~~~~~~~~~~~~~~~~~~~
   drivers/virt/coco/tdx-host/tdx-host.c:214:9: note: initialize the variable 'ret' to silence this warning
     214 |         int ret;
         |                ^
         |                 = 0
   1 warning generated.


vim +221 drivers/virt/coco/tdx-host/tdx-host.c

   210	
   211	static int tdx_spdm_session_setup(struct tdx_tsm_link *tlink)
   212	{
   213		struct page *in_msg_page, *out_msg_page;
   214		int ret;
   215	
   216		in_msg_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
   217		if (!in_msg_page)
   218			return -ENOMEM;
   219	
   220		out_msg_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
 > 221		if (!out_msg_page)
   222			goto out_free_in_msg;
   223	
   224		tlink->in_msg = in_msg_page;
   225		tlink->out_msg = out_msg_page;
   226	
   227		ret = tdx_spdm_create(tlink);
   228		if (ret)
   229			goto out_free_out_msg;
   230	
   231		ret = tdx_spdm_session_connect(tlink);
   232		if (ret)
   233			goto out_spdm_delete;
   234	
   235		return 0;
   236	
   237	out_spdm_delete:
   238		tdx_spdm_delete(tlink);
   239	out_free_out_msg:
   240		__free_page(out_msg_page);
   241	out_free_in_msg:
   242		__free_page(in_msg_page);
   243		return ret;
   244	}
   245	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2026-10-21 23:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202610220625.gi2GBN5M-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=yilun.xu@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox