Re: [PATCH v13 1/3] x86/tdx: Add TDX Guest attestation interface driver

From: Greg Kroah-Hartman
Date: Thu Sep 15 2022 - 07:09:04 EST


On Fri, Sep 09, 2022 at 12:27:06PM -0700, Kuppuswamy Sathyanarayanan wrote:
> +static int __init tdx_guest_init(void)
> +{
> + int ret;
> +
> + if (!cpu_feature_enabled(X86_FEATURE_TDX_GUEST))
> + return -EIO;
> +
> + ret = misc_register(&tdx_misc_dev);
> + if (ret) {
> + pr_err("misc device registration failed\n");
> + return ret;
> + }
> +
> + return 0;
> +}
> +device_initcall(tdx_guest_init)

As mentioned elsewhere, make this a normal module_init() format and only
load the module if the hardware is present. Don't just always be
built/loaded, that's not ok.

thanks,

greg k-h