From: Heinrich Schuchardt Date: Mon, 25 Oct 2021 22:41:59 +0000 (+0200) Subject: env: superfluous check before free() X-Git-Url: http://git.dujemihanovic.xyz/html/static/gitweb.css?a=commitdiff_plain;h=28ab12ad145d92de13baf679c8e3733be99ee95e;p=u-boot.git env: superfluous check before free() Free() checks if its argument in NULL. There is no need for the caller to do the same. Signed-off-by: Heinrich Schuchardt --- diff --git a/env/flash.c b/env/flash.c index ebee9069e4..473e82454d 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;