]> git.baikalelectronics.ru Git - uboot.git/commitdiff
env: superfluous check before free()
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Mon, 25 Oct 2021 22:41:59 +0000 (00:41 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 26 Oct 2021 19:26:45 +0000 (15:26 -0400)
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>
env/flash.c

index ebee9069e4e3df53c5ceddbce07b91a9c082ee38..473e82454ded45c58ac9d80a96554e5a50b81317 100644 (file)
@@ -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;