Re: [RFC PATCH v3 08/27] x86/sgx: Initialize virtual EPC driver even when SGX driver is disabled

Dave Hansen
2021-02-04T22:42:32Z

On 2/4/21 6:51 AM, Jarkko Sakkinen wrote:
>>> A: ret == -ENODEV
>>> B: ret == 0
>>> C: ret != 0 && ret != -ENODEV
>> Let me try again:
>>
>> Why A and C should be treated differently? What will behave incorrectly, in case of
>> C?
> So you don't know what different error codes mean?

How about we just leave the check in place as Sean wrote it, and add a
nice comment to explain what it is doing:

/*
* Always try to initialize the native *and* KVM drivers.
* The KVM driver is less picky than the native one and
* can function if the native one is not supported on the
* current system or fails to initialize.
*
* Error out only if both fail to initialize.
*/
ret = !!sgx_drv_init() & !!sgx_vepc_init();
if (ret)
goto err_kthread;