From 778358d0a8f74a76488daea3c1b6fb327d8135b4 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 14 Sep 2015 13:52:23 +0200 Subject: rocker: Use g_new() & friends where that makes obvious sense g_new(T, n) is neater than g_malloc(sizeof(T) * n). It's also safer, for two reasons. One, it catches multiplication overflowing size_t. Two, it returns T * rather than void *, which lets the compiler catch more type errors. This commit only touches allocations with size arguments of the form sizeof(T). Same Coccinelle semantic patchas in commit b45c03f. Signed-off-by: Markus Armbruster Acked-by: Jiri Pirko Reviewed-by: Eric Blake Reviewed-by: Jiri Pirko Signed-off-by: Michael Tokarev --- hw/net/rocker/rocker_fp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw/net/rocker/rocker_fp.c') diff --git a/hw/net/rocker/rocker_fp.c b/hw/net/rocker/rocker_fp.c index c693ae5081..5906396b9d 100644 --- a/hw/net/rocker/rocker_fp.c +++ b/hw/net/rocker/rocker_fp.c @@ -218,7 +218,7 @@ FpPort *fp_port_alloc(Rocker *r, char *sw_name, MACAddr *start_mac, unsigned int index, NICPeers *peers) { - FpPort *port = g_malloc0(sizeof(FpPort)); + FpPort *port = g_new0(FpPort, 1); if (!port) { return NULL; -- cgit v1.2.3