On 1/23/2026 10:55 PM, Chao Gao wrote:
> "%#" format specifier automatically adds the "0x" prefix and has one less
> character than "0x%".
>
> For conciseness, replace "0x%" with "%#" when printing hexadecimal values
> in SEAMCALL error messages.
>
> Suggested-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Chao Gao <chao.gao@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com>
> ---
> "0x%" is also used to print TDMR ranges. I didn't convert them to reduce
> code churn, but if they should be converted for consistency, I'm happy
> to do that.
Generally, is there any preference for coding in Linux kernel about
"0x%" VS. "%#"? Or developers just make their own choices?
>
> v2: new
> ---
> arch/x86/virt/vmx/tdx/tdx.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
> index dbc7cb08ca53..2218bb42af40 100644
> --- a/arch/x86/virt/vmx/tdx/tdx.c
> +++ b/arch/x86/virt/vmx/tdx/tdx.c
> @@ -63,16 +63,16 @@ typedef void (*sc_err_func_t)(u64 fn, u64 err, struct tdx_module_args *args);
>
> static inline void seamcall_err(u64 fn, u64 err, struct tdx_module_args *args)
> {
> - pr_err("SEAMCALL (%llu) failed: 0x%016llx\n", fn, err);
> + pr_err("SEAMCALL (%llu) failed: %#016llx\n", fn, err);
> }
>
> static inline void seamcall_err_ret(u64 fn, u64 err,
> struct tdx_module_args *args)
> {
> seamcall_err(fn, err, args);
> - pr_err("RCX 0x%016llx RDX 0x%016llx R08 0x%016llx\n",
> + pr_err("RCX %#016llx RDX %#016llx R08 %#016llx\n",
> args->rcx, args->rdx, args->r8);
> - pr_err("R09 0x%016llx R10 0x%016llx R11 0x%016llx\n",
> + pr_err("R09 %#016llx R10 %#016llx R11 %#016llx\n",
> args->r9, args->r10, args->r11);
> }
>