[PATCH] armv8: sec_firmware: drop unneeded ARMV8_SEC_FIRMWARE_SUPPORT check

This module will only be compiled if this symbol is set. Remove the useless check. While at it, invert the return code, to return 0 if the function succeeds. The only user of this function in arch/arm/cpu/armv8/fsl-layerscape/fdt.c doesn't check the return code anyway, so its safe change it.
Signed-off-by: Michael Walle michael@walle.cc --- arch/arm/cpu/armv8/sec_firmware.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/arch/arm/cpu/armv8/sec_firmware.c b/arch/arm/cpu/armv8/sec_firmware.c index 267894fbcb..e62e9dc380 100644 --- a/arch/arm/cpu/armv8/sec_firmware.c +++ b/arch/arm/cpu/armv8/sec_firmware.c @@ -458,47 +458,45 @@ int sec_firmware_init(const void *sec_firmware_img, /* * fdt_fix_kaslr - Add kalsr-seed node in Device tree * @fdt: Device tree - * @eret: 0 in case of error, 1 for success + * + * Returns 0 on success and 1 in case of an error. */ int fdt_fixup_kaslr(void *fdt) { int nodeoffset; - int err, ret = 0; + int err; u8 rand[8];
-#if defined(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT) /* Check if random seed generation is supported */ if (sec_firmware_support_hwrng() == false) { printf("WARNING: SEC firmware not running, no kaslr-seed\n"); - return 0; + return 1; }
ret = sec_firmware_get_random(rand, 8); if (ret < 0) { printf("WARNING: No random number to set kaslr-seed\n"); - return 0; + return 1; }
err = fdt_check_header(fdt); if (err < 0) { printf("fdt_chosen: %s\n", fdt_strerror(err)); - return 0; + return 1; }
/* find or create "/chosen" node. */ nodeoffset = fdt_find_or_add_subnode(fdt, 0, "chosen"); if (nodeoffset < 0) - return 0; + return 1;
err = fdt_setprop(fdt, nodeoffset, "kaslr-seed", rand, sizeof(rand)); if (err < 0) { printf("WARNING: can't set kaslr-seed %s.\n", fdt_strerror(err)); - return 0; + return 1; } - ret = 1; -#endif
- return ret; + return 0; }

Am 2021-11-26 17:11, schrieb Michael Walle:
This module will only be compiled if this symbol is set. Remove the useless check. While at it, invert the return code, to return 0 if the function succeeds. The only user of this function in arch/arm/cpu/armv8/fsl-layerscape/fdt.c doesn't check the return code anyway, so its safe change it.
Signed-off-by: Michael Walle michael@walle.cc
Ping? :)
Tom, this is assigned to you in patchwork.
-michael

On Fri, Nov 26, 2021 at 05:11:36PM +0100, Michael Walle wrote:
This module will only be compiled if this symbol is set. Remove the useless check. While at it, invert the return code, to return 0 if the function succeeds. The only user of this function in arch/arm/cpu/armv8/fsl-layerscape/fdt.c doesn't check the return code anyway, so its safe change it.
Signed-off-by: Michael Walle michael@walle.cc
arch/arm/cpu/armv8/sec_firmware.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
Currently this causes a large number of platforms to fail to build such as ls1012aqds_tfa_SECURE_BOOT, please fix and resubmit, thanks.

Am 2022-04-06 15:09, schrieb Tom Rini:
On Fri, Nov 26, 2021 at 05:11:36PM +0100, Michael Walle wrote:
This module will only be compiled if this symbol is set. Remove the useless check. While at it, invert the return code, to return 0 if the function succeeds. The only user of this function in arch/arm/cpu/armv8/fsl-layerscape/fdt.c doesn't check the return code anyway, so its safe change it.
Signed-off-by: Michael Walle michael@walle.cc
arch/arm/cpu/armv8/sec_firmware.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
Currently this causes a large number of platforms to fail to build such as ls1012aqds_tfa_SECURE_BOOT, please fix and resubmit, thanks.
Ahh, right, I guess that is because that ifdeffery is needed to distiguish the SPL build. In this case, this can be dropped.
Sorry for the noise, -michael
participants (2)
-
Michael Walle
-
Tom Rini