diff options
author | Samuel Holland <samuel@sholland.org> | 2021-01-16 01:21:38 -0600 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2021-01-24 17:15:41 -0600 |
commit | 814dce8f96fdb82d095b0041a204ba4a272c0913 (patch) | |
tree | e70d2d978753a55b036d33d94a044920eda9df5c /plat/allwinner/common | |
parent | 772ef7e7af16cef85c20e24d3e64f52287785ec3 (diff) | |
download | trusted-firmware-a-814dce8f96fdb82d095b0041a204ba4a272c0913.tar.gz |
allwinner: psci: Invert check in .validate_ns_entrypoint
Checking the exceptional case and letting the success case fall through
is not only more idiomatic, but it also allows adding more exceptional
cases in the future, such as a check for overlapping secure DRAM.
Change-Id: I720441a6a8853fd7f211ebe851f14d921a6db03d
Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'plat/allwinner/common')
-rw-r--r-- | plat/allwinner/common/sunxi_pm.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/plat/allwinner/common/sunxi_pm.c b/plat/allwinner/common/sunxi_pm.c index e70d859e3a..aa80c528b9 100644 --- a/plat/allwinner/common/sunxi_pm.c +++ b/plat/allwinner/common/sunxi_pm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2021, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -207,10 +207,11 @@ static int sunxi_validate_power_state(unsigned int power_state, static int sunxi_validate_ns_entrypoint(uintptr_t ns_entrypoint) { /* The non-secure entry point must be in DRAM */ - if (ns_entrypoint >= SUNXI_DRAM_BASE) - return PSCI_E_SUCCESS; + if (ns_entrypoint < SUNXI_DRAM_BASE) { + return PSCI_E_INVALID_ADDRESS; + } - return PSCI_E_INVALID_ADDRESS; + return PSCI_E_SUCCESS; } static void sunxi_get_sys_suspend_power_state(psci_power_state_t *req_state) |