armv8: sec_firmware: drop unneeded ARMV8_SEC_FIRMWARE_SUPPORT check
PATCH 1/1 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.
--- arch/arm/cpu/armv8/sec_firmware.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
arch/arm/cpu/armv8/sec_firmware.c +9 -11
@@ -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 ; }
Signature · 1 line
2.30.2
Am 2021-11-26 17:11, schrieb Michael Walle:
Quoted 7 lines
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.cdoesn't check the return code anyway, so its safe change it.Signed-off-by Michael Walle <[email protected]>
Ping? :)
Tom, this is assigned to you in patchwork.
-michael
Quoted 10 lines · 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.cdoesn't check the return code anyway, so its safe change it.Signed-off-by Michael Walle <[email protected]>--- 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.
Signature · 1 line
Tom
Am 2022-04-06 15:09, schrieb Tom Rini:
Quoted 8 lines · Michael Walle
Quoted 7 lines
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.cdoesn't check the return code anyway, so its safe change it.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Michael Walle <[email protected]>--- 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