aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2021-10-26 00:41:59 +0200
committerTom Rini <trini@konsulko.com>2021-10-26 15:26:45 -0400
commit28ab12ad145d92de13baf679c8e3733be99ee95e (patch)
treeb088ee2d5955e72327db9660fdfcce1898aafc7d
parent73d18e352d97b5e9a3de3780d5c9117d44993c41 (diff)
downloadu-boot-WIP/2021-10-26-add-nand-biterr-and-bugfixes.zip
u-boot-WIP/2021-10-26-add-nand-biterr-and-bugfixes.tar.gz
u-boot-WIP/2021-10-26-add-nand-biterr-and-bugfixes.tar.bz2
env: superfluous check before free()WIP/2021-10-26-add-nand-biterr-and-bugfixes
Free() checks if its argument in NULL. There is no need for the caller to do the same. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
-rw-r--r--env/flash.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/env/flash.c b/env/flash.c
index ebee906..473e824 100644
--- a/env/flash.c
+++ b/env/flash.c
@@ -210,8 +210,7 @@ static int env_flash_save(void)
perror:
flash_perror(rc);
done:
- if (saved_data)
- free(saved_data);
+ free(saved_data);
/* try to re-protect */
flash_sect_protect(1, (ulong)flash_addr, end_addr);
flash_sect_protect(1, (ulong)flash_addr_new, end_addr_new);
@@ -298,8 +297,7 @@ static int env_flash_save(void)
perror:
flash_perror(rc);
done:
- if (saved_data)
- free(saved_data);
+ free(saved_data);
/* try to re-protect */
flash_sect_protect(1, (long)flash_addr, end_addr);
return rc;