From ef1e1e0782e99c9dcf2b35e5310cdd8ca9211374 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Wed, 26 Aug 2015 12:17:18 +0100 Subject: maint: avoid useless "if (foo) free(foo)" pattern The free() and g_free() functions both happily accept NULL on any platform QEMU builds on. As such putting a conditional 'if (foo)' check before calls to 'free(foo)' merely serves to bloat the lines of code. Signed-off-by: Daniel P. Berrange Reviewed-by: Markus Armbruster Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- hw/sd/sd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'hw/sd') diff --git a/hw/sd/sd.c b/hw/sd/sd.c index a1ff465a67..3e2a451154 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -412,8 +412,7 @@ static void sd_reset(SDState *sd) sd_set_cardstatus(sd); sd_set_sdstatus(sd); - if (sd->wp_groups) - g_free(sd->wp_groups); + g_free(sd->wp_groups); sd->wp_switch = sd->blk ? blk_is_read_only(sd->blk) : false; sd->wpgrps_size = sect; sd->wp_groups = bitmap_new(sd->wpgrps_size); -- cgit v1.2.3