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 <mich...@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;
 }
-- 
2.30.2

Reply via email to