diff mbox series

[1/1] spl: fit: do not check argument of free()

Message ID 20200420104401.5584-1-xypron.glpk@gmx.de
State Accepted
Commit 077e72c6e6266a215cdbb8bfb07d791cb9c070ec
Headers show
Series [1/1] spl: fit: do not check argument of free() | expand

Commit Message

Heinrich Schuchardt April 20, 2020, 10:44 a.m. UTC
The free() function checks if its argument is NULL. It is superfluous to do
the same check on the calling side.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 common/spl/spl_fit.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--
2.25.1

Comments

Tom Rini April 26, 2020, 11:28 a.m. UTC | #1
On Mon, Apr 20, 2020 at 12:44:01PM +0200, Heinrich Schuchardt wrote:

> The free() function checks if its argument is NULL. It is superfluous to do
> the same check on the calling side.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 69dabd27f6..c51e4beb1c 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -425,8 +425,7 @@  static int spl_fit_append_fdt(struct spl_image_info *spl_image,
 			debug("%s: DT overlay %s applied\n", __func__,
 			      fit_get_name(fit, node, NULL));
 		}
-		if (tmpbuffer)
-			free(tmpbuffer);
+		free(tmpbuffer);
 		if (ret)
 			return ret;
 	}