tspd:FWU:Fix usage of SMC_RET0
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>
Tue, 4 Apr 2017 16:08:32 +0000 (17:08 +0100)
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>
Thu, 20 Apr 2017 08:54:59 +0000 (09:54 +0100)
SMC_RET0 should only be used when the SMC code works as a function that
returns void. If the code of the SMC uses SMC_RET1 to return a value to
signify success and doesn't return anything in case of an error (or the
other way around) SMC_RET1 should always be used to return clearly
identifiable values.

This patch fixes two cases in which the code used SMC_RET0 instead of
SMC_RET1.

It also introduces the define SMC_OK to use when an SMC must return a
value to tell that it succeeded, the same way as SMC_UNK is used in case
of failure.

Change-Id: Ie4278b51559e4262aced13bbde4e844023270582
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
bl1/bl1_fwu.c
include/lib/smcc.h
services/spd/tspd/tspd_main.c

index f7fae68231c7cbb44c7c68786e7300f472b2d3fc..e2ede681741931d96f0631cc1dfe4bf520dee4af 100644 (file)
@@ -109,7 +109,7 @@ register_t bl1_fwu_smc_handler(unsigned int smc_fid,
                break;
        }
 
-       SMC_RET0(handle);
+       SMC_RET1(handle, SMC_UNK);
 }
 
 /*******************************************************************************
index 2f562c5dcb13c22545c32daf85e1e24563ce610f..a4c4b6c0c7907d15ab02ba5a2de56789f3dc1a55 100644 (file)
@@ -58,6 +58,7 @@
 
 #define SMC_64                         1
 #define SMC_32                         0
+#define SMC_OK                         0
 #define SMC_UNK                                0xffffffff
 #define SMC_TYPE_FAST                  ULL(1)
 #define SMC_TYPE_STD                   0
index ff515cca2f36c71f86cf027b0dbce113685d29e5..e5ec5cd22ad9b97c3e1c7ba82a73972b4e2edc76 100644 (file)
@@ -631,7 +631,7 @@ uint64_t tspd_smc_handler(uint32_t smc_fid,
 
                cm_el1_sysregs_context_restore(NON_SECURE);
                cm_set_next_eret_context(NON_SECURE);
-               SMC_RET0(handle);
+               SMC_RET1(handle, SMC_OK);
 
                /*
                 * Request from non secure world to resume the preempted