public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony.lindgren@linux.intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Sean Christopherson <seanjc@google.com>
Cc: Tony Lindgren <tony.lindgren@linux.intel.com>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Isaku Yamahata <isaku.yamahata@intel.com>,
	Binbin Wu <binbin.wu@linux.intel.com>,
	Xiaoyao Li <xiaoyao.li@intel.com>,
	kvm@vger.kernel.org, Rick Edgecombe <rick.p.edgecombe@intel.com>
Subject: [PATCH 1/1] KVM: TDX: Fix uninitialized error code for __tdx_bringup()
Date: Tue,  9 Sep 2025 13:16:38 +0300	[thread overview]
Message-ID: <20250909101638.170135-1-tony.lindgren@linux.intel.com> (raw)

Fix a Smatch static checker warning reported by Dan:

	arch/x86/kvm/vmx/tdx.c:3464 __tdx_bringup()
	warn: missing error code 'r'

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Fixes:  61bb28279623 ("KVM: TDX: Get system-wide info about TDX module on initialization")
Signed-off-by: Tony Lindgren <tony.lindgren@linux.intel.com>
---
 arch/x86/kvm/vmx/tdx.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
index 66744f5768c8..3ce7fe08afd8 100644
--- a/arch/x86/kvm/vmx/tdx.c
+++ b/arch/x86/kvm/vmx/tdx.c
@@ -3466,11 +3466,15 @@ static int __init __tdx_bringup(void)
 
 	/* Check TDX module and KVM capabilities */
 	if (!tdx_get_supported_attrs(&tdx_sysinfo->td_conf) ||
-	    !tdx_get_supported_xfam(&tdx_sysinfo->td_conf))
+	    !tdx_get_supported_xfam(&tdx_sysinfo->td_conf)) {
+		r = -EINVAL;
 		goto get_sysinfo_err;
+	}
 
-	if (!(tdx_sysinfo->features.tdx_features0 & MD_FIELD_ID_FEATURES0_TOPOLOGY_ENUM))
+	if (!(tdx_sysinfo->features.tdx_features0 & MD_FIELD_ID_FEATURES0_TOPOLOGY_ENUM)) {
+		r = -EINVAL;
 		goto get_sysinfo_err;
+	}
 
 	/*
 	 * TDX has its own limit of maximum vCPUs it can support for all
-- 
2.43.0


             reply	other threads:[~2025-09-09 10:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09 10:16 Tony Lindgren [this message]
2025-09-09 10:55 ` [PATCH 1/1] KVM: TDX: Fix uninitialized error code for __tdx_bringup() Huang, Kai
2025-09-09 11:05   ` Tony Lindgren
2025-09-09 13:45     ` Sean Christopherson
2025-09-09 22:19       ` Huang, Kai

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=20250909101638.170135-1-tony.lindgren@linux.intel.com \
    --to=tony.lindgren@linux.intel.com \
    --cc=binbin.wu@linux.intel.com \
    --cc=dan.carpenter@linaro.org \
    --cc=isaku.yamahata@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=seanjc@google.com \
    --cc=xiaoyao.li@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