On Wed, 2025-01-08 at 10:34 +0800, Gao, Chao wrote: > > @@ -147,11 +278,17 @@ static int __init __tdx_bringup(void) > > goto get_sysinfo_err; > > } > > > > + /* Check TDX module and KVM capabilities */ > > + if (!tdx_get_supported_attrs(&tdx_sysinfo->td_conf) || > > + !tdx_get_supported_xfam(&tdx_sysinfo->td_conf)) > > + goto get_sysinfo_err; > > The return value should be set to -EINVAL before the goto. > Yeah. Sean actually pointed this out before. I proposed internally to do below change to the patch "[PATCH v2 02/25] KVM: TDX: Get TDX global information": --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -3274,12 +3274,11 @@ static int __init __tdx_bringup(void) if (r) goto tdx_bringup_err; + r = -EINVAL; /* Get TDX global information for later use */ tdx_sysinfo = tdx_get_sysinfo(); - if (WARN_ON_ONCE(!tdx_sysinfo)) { - r = -EINVAL; + if (WARN_ON_ONCE(!tdx_sysinfo)) goto get_sysinfo_err; - } .. so that further failures can just 'goto <err_label>'. I.e., below should be done to the patch "[PATCH v2 18/25] KVM: TDX: Support per-VM KVM_CAP_MAX_VCPUS extension check": /* Check TDX module and KVM capabilities */ if (!tdx_get_supported_attrs(&tdx_sysinfo->td_conf) || @@ -3319,7 +3318,6 @@ static int __init __tdx_bringup(void) if (td_conf->max_vcpus_per_td < num_present_cpus()) { pr_err("Disable TDX: MAX_VCPU_PER_TD (%u) smaller than number of logical CPUs (%u).\n", td_conf->max_vcpus_per_td, num_present_cpus()); - r = -EINVAL; goto get_sysinfo_err; } Alternatively, we can just set ret to -EINVAL before the goto which is a simple fix to this patch, which probably is easier for Paolo to do.