[intel-sgx-kernel-dev,2/5] intel_sgx: always assume encl parameter for sgx_free_page()
diff mbox

Message ID 20170131230308.7561-3-jarkko.sakkinen@linux.intel.com
State New
Headers show

Commit Message

Jarkko Sakkinen Jan. 31, 2017, 11:03 p.m. UTC
The encl parameter is passed in all call sites so we make it as a
requirement.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 drivers/platform/x86/intel_sgx_page_cache.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Patch
diff mbox

diff --git a/drivers/platform/x86/intel_sgx_page_cache.c b/drivers/platform/x86/intel_sgx_page_cache.c
index d2b8baa..3c6c7a4 100644
--- a/drivers/platform/x86/intel_sgx_page_cache.c
+++ b/drivers/platform/x86/intel_sgx_page_cache.c
@@ -539,12 +539,10 @@  void sgx_free_page(struct sgx_epc_page *entry,
 	void *epc;
 	int ret;
 
-	if (encl) {
-		atomic_dec(&encl->tgid_ctx->epc_cnt);
+	atomic_dec(&encl->tgid_ctx->epc_cnt);
 
-		if (encl->flags & SGX_ENCL_SUSPEND)
-			flags |= SGX_FREE_SKIP_EREMOVE;
-	}
+	if (encl->flags & SGX_ENCL_SUSPEND)
+		flags |= SGX_FREE_SKIP_EREMOVE;
 
 	if (!(flags & SGX_FREE_SKIP_EREMOVE)) {
 		epc = sgx_get_epc_page(entry);