diff options
author | Andre Przywara <andre.przywara@arm.com> | 2019-09-16 16:50:57 +0100 |
---|---|---|
committer | Sandrine Bailleux <sandrine.bailleux@arm.com> | 2020-01-22 07:52:18 +0000 |
commit | feb358b65151f7c4d6656a4ee52199f205798ce8 (patch) | |
tree | feb8e21b72f1e7fd0367cce4ae181ac1f4542ae2 /common | |
parent | e5eaf885cc656153c0225138cc2426f398e328ee (diff) | |
download | arm-trusted-firmware-feb358b65151f7c4d6656a4ee52199f205798ce8.tar.gz |
FDT helper functions: Fix MISRA issues
Moving the FDT helper functions to the common/ directory exposed the file
to MISRA checking, which is mandatory for common code.
Fix the complaints that the test suite reported.
Change-Id: Ica8c8a95218bba5a3fd92a55407de24df58e8476
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Diffstat (limited to 'common')
-rw-r--r-- | common/fdt_fixup.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/common/fdt_fixup.c b/common/fdt_fixup.c index 99d0eee98..d518eb2a4 100644 --- a/common/fdt_fixup.c +++ b/common/fdt_fixup.c @@ -95,7 +95,7 @@ int dt_add_psci_node(void *fdt) * or none have to be patched in the first place. * Returns 1 if *one* such subnode has been found and successfully changed * to "psci". - * Returns -1 on error. + * Returns negative values on error. * * Call in a loop until it returns 0. Recalculate the node offset after * it has returned 1. @@ -109,20 +109,23 @@ static int dt_update_one_cpu_node(void *fdt, int offset) offs = fdt_next_subnode(fdt, offs)) { const char *prop; int len; + int ret; prop = fdt_getprop(fdt, offs, "device_type", &len); - if (!prop) + if (prop == NULL) continue; - if (memcmp(prop, "cpu", 4) != 0 || len != 4) + if ((strcmp(prop, "cpu") != 0) || (len != 4)) continue; /* Ignore any nodes which already use "psci". */ prop = fdt_getprop(fdt, offs, "enable-method", &len); - if (prop && memcmp(prop, "psci", 5) == 0 && len == 5) + if ((prop != NULL) && + (strcmp(prop, "psci") == 0) && (len == 5)) continue; - if (fdt_setprop_string(fdt, offs, "enable-method", "psci")) - return -1; + ret = fdt_setprop_string(fdt, offs, "enable-method", "psci"); + if (ret < 0) + return ret; /* * Subnode found and patched. * Restart to accommodate potentially changed offsets. |