Re: [PATCH v4 09/10] x86/virt/tdx: Use early returns in get_tdx_sys_info()

From: Xu Yilun

Date: Wed Oct 14 2026 - 04:30:16 EST


On Mon, Oct 12, 2026 at 02:47:36AM -0700, Chao Gao wrote:
> get_tdx_sys_info() was generated by a script. It chains its metadata reads
> with:
>
> ret = ret ?: get_tdx_sys_info_foo(...);
>
> The function is maintained by hand now. Use conventional early returns
> instead.
>
> Print the module version only after its metadata has been read
> successfully. The "ret ?:" chain has no early exit, so the pr_info() after
> the version read prints a partially read or all-zero version when that read
> fails. That is harmless, but once every other read returns on error, a

I would not say this is harmless, my version FYR:

That is wrong but not fatal. But once every ... a print after a
failed read is an obvious bug.

> print after a failed read would look like a bug.
>
> AI was used under supervision to review code and workshop logs.
>
> Signed-off-by: Chao Gao <chao.gao@xxxxxxxxx>
> Reviewed-by: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>

Otherwise

Reviewed-by: Xu Yilun <yilun.xu@xxxxxxxxxxxxxxx>