summaryrefslogtreecommitdiff
path: root/hw/net/fsl_etsec/rings.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2015-08-26 12:17:18 +0100
committerMichael Tokarev <mjt@tls.msk.ru>2015-09-11 10:21:38 +0300
commitef1e1e0782e99c9dcf2b35e5310cdd8ca9211374 (patch)
tree0b0f9a746055b66019016ed2d8e4ff9df7d79a8c /hw/net/fsl_etsec/rings.c
parent4595a48a10e576638795950b61957f83d2ed09b4 (diff)
downloadqemu-ef1e1e0782e99c9dcf2b35e5310cdd8ca9211374.zip
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 <berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw/net/fsl_etsec/rings.c')
-rw-r--r--hw/net/fsl_etsec/rings.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/hw/net/fsl_etsec/rings.c b/hw/net/fsl_etsec/rings.c
index 68e7b6d16b..0a5c6cfe3f 100644
--- a/hw/net/fsl_etsec/rings.c
+++ b/hw/net/fsl_etsec/rings.c
@@ -464,9 +464,7 @@ static void rx_init_frame(eTSEC *etsec, const uint8_t *buf, size_t size)
etsec->rx_fcb_size = 0;
}
- if (etsec->rx_buffer != NULL) {
- g_free(etsec->rx_buffer);
- }
+ g_free(etsec->rx_buffer);
/* Do not copy the frame for now */
etsec->rx_buffer = (uint8_t *)buf;