Re: [PATCH v5 11/22] x86/virt/seamldr: Shut down the current TDX module
From: Chao Gao
Date: Sun Mar 22 2026 - 21:35:34 EST
On Fri, Mar 20, 2026 at 04:22:10PM +0800, Chao Gao wrote:
>>> +static int get_tdx_sys_info_handoff(struct tdx_sys_info_handoff *sysinfo_handoff)
>>> +{
>>> + int ret = 0;
>>> + u64 val;
>>> +
>>> + if (!ret && !(ret = read_sys_metadata_field(0x8900000100000000, &val)))
>>
>>!ret check is redundant as well as the ret initialization above.
>
>Ok. Will remove them:
>
>static int get_tdx_sys_info_handoff(struct tdx_sys_info_handoff *sysinfo_handoff)
>{
> int ret;
> u64 val;
>
> if (!(ret = read_sys_metadata_field(0x8900000100000000, &val)))
> sysinfo_handoff->module_hv = val;
> return ret;
>}
While making this change, I'll also fix the checkpatch.pl error:
ERROR: do not use assignment in if condition
#23: FILE: arch/x86/virt/vmx/tdx/tdx_global_metadata.c:108:
+ if (!(ret = read_sys_metadata_field(0x8900000100000000, &val)))
Updated version:
static int get_tdx_sys_info_handoff(struct tdx_sys_info_handoff *sysinfo_handoff)
{
int ret;
u64 val;
ret = read_sys_metadata_field(0x8900000100000000, &val);
if (ret)
return ret;
sysinfo_handoff->module_hv = val;
return 0;
}