public inbox for linux-sgx@vger.kernel.org
 help / color / mirror / Atom feed
From: Darren Kenny <darren.kenny@oracle.com>
To: Sami Tolvanen <samitolvanen@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Jarkko Sakkinen <jarkko@kernel.org>,
	Sean Christopherson <seanjc@google.com>
Cc: Kees Cook <keescook@chromium.org>,
	x86@kernel.org, linux-sgx@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Sami Tolvanen <samitolvanen@google.com>
Subject: Re: [PATCH] x86/sgx: fix the return type of sgx_init
Date: Thu, 14 Jan 2021 12:12:12 +0000	[thread overview]
Message-ID: <m2zh1bvhsz.fsf@oracle.com> (raw)
In-Reply-To: <20210113232311.277302-1-samitolvanen@google.com>

On Wednesday, 2021-01-13 at 15:23:11 -08, Sami Tolvanen wrote:
> device_initcall() expects a function of type initcall_t, which returns
> an integer. Change the signature of sgx_init() to match.
>
> Fixes: e7e0545299d8c ("x86/sgx: Initialize metadata for Enclave Page Cache (EPC) sections")
> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>

Makes sense.

Reviewed-by: Darren Kenny <darren.kenny@oracle.com>

> ---
>  arch/x86/kernel/cpu/sgx/main.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c
> index c519fc5f6948..8df81a3ed945 100644
> --- a/arch/x86/kernel/cpu/sgx/main.c
> +++ b/arch/x86/kernel/cpu/sgx/main.c
> @@ -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);
>
> base-commit: 65f0d2414b7079556fbbcc070b3d1c9f9587606d
> -- 
> 2.30.0.284.gd98b1dd5eaa7-goog

  reply	other threads:[~2021-01-14 12:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13 23:23 [PATCH] x86/sgx: fix the return type of sgx_init Sami Tolvanen
2021-01-14 12:12 ` Darren Kenny [this message]
2021-01-15 10:08   ` Jarkko Sakkinen
2021-01-15 10:08 ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2zh1bvhsz.fsf@oracle.com \
    --to=darren.kenny@oracle.com \
    --cc=bp@alien8.de \
    --cc=jarkko@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=samitolvanen@google.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox