Commit 31bf9288 authored by Sami Tolvanen's avatar Sami Tolvanen Committed by Borislav Petkov
Browse files

x86/sgx: Fix the return type of sgx_init()



device_initcall() expects a function of type initcall_t, which returns
an integer. Change the signature of sgx_init() to match.

Fixes: e7e05452 ("x86/sgx: Initialize metadata for Enclave Page Cache (EPC) sections")
Signed-off-by: default avatarSami Tolvanen <samitolvanen@google.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Reviewed-by: default avatarDarren Kenny <darren.kenny@oracle.com>
Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
Link: https://lkml.kernel.org/r/20210113232311.277302-1-samitolvanen@google.com
parent 7c53f6b6
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -700,25 +700,27 @@ static bool __init sgx_page_cache_init(void)
	return true;
}

static void __init sgx_init(void)
static int __init sgx_init(void)
{
	int ret;
	int i;

	if (!cpu_feature_enabled(X86_FEATURE_SGX))
		return;
		return -ENODEV;

	if (!sgx_page_cache_init())
		return;
		return -ENOMEM;

	if (!sgx_page_reclaimer_init())
	if (!sgx_page_reclaimer_init()) {
		ret = -ENOMEM;
		goto err_page_cache;
	}

	ret = sgx_drv_init();
	if (ret)
		goto err_kthread;

	return;
	return 0;

err_kthread:
	kthread_stop(ksgxd_tsk);
@@ -728,6 +730,8 @@ static void __init sgx_init(void)
		vfree(sgx_epc_sections[i].pages);
		memunmap(sgx_epc_sections[i].virt_addr);
	}

	return ret;
}

device_initcall(sgx_init);