public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] KVM: TDX: Fix uninitialized error code for __tdx_bringup()
@ 2025-09-09 10:16 Tony Lindgren
  2025-09-09 10:55 ` Huang, Kai
  0 siblings, 1 reply; 5+ messages in thread
From: Tony Lindgren @ 2025-09-09 10:16 UTC (permalink / raw)
  To: Paolo Bonzini, Sean Christopherson
  Cc: Tony Lindgren, Dan Carpenter, Isaku Yamahata, Binbin Wu,
	Xiaoyao Li, kvm, Rick Edgecombe

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-09-09 22:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-09 10:16 [PATCH 1/1] KVM: TDX: Fix uninitialized error code for __tdx_bringup() Tony Lindgren
2025-09-09 10:55 ` Huang, Kai
2025-09-09 11:05   ` Tony Lindgren
2025-09-09 13:45     ` Sean Christopherson
2025-09-09 22:19       ` Huang, Kai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox