diff options
author | Mao Zhongyi <maozy.fnst@cn.fujitsu.com> | 2017-08-14 11:33:07 +0800 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2017-09-08 08:17:37 +0800 |
commit | 107e4b352cc309f9bd7588ef1a44549200620078 (patch) | |
tree | 50a7dc360ddd299a00f4a694bd56b9c27792e81e /hw/net/rocker/rocker_of_dpa.c | |
parent | 6ce310b5356abb7edc3aa8b8b097d0b8cc76f83f (diff) | |
download | qemu-107e4b352cc309f9bd7588ef1a44549200620078.zip qemu-107e4b352cc309f9bd7588ef1a44549200620078.tar.gz qemu-107e4b352cc309f9bd7588ef1a44549200620078.tar.bz2 |
net/rocker: Remove the dead error handling
Memory allocation functions like world_alloc, desc_ring_alloc etc,
they are all wrappers around g_malloc, g_new etc. But g_malloc and
similar functions doesn't return null. Because they ignore the fact
that g_malloc() of 0 bytes returns null. So error checks for these
allocation failure are superfluous. Now, remove them entirely.
Cc: jasowang@redhat.com
Cc: jiri@resnulli.us
Cc: armbru@redhat.com
Cc: f4bug@amsat.org
Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw/net/rocker/rocker_of_dpa.c')
-rw-r--r-- | hw/net/rocker/rocker_of_dpa.c | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/hw/net/rocker/rocker_of_dpa.c b/hw/net/rocker/rocker_of_dpa.c index 9b1e0d2..191a58e 100644 --- a/hw/net/rocker/rocker_of_dpa.c +++ b/hw/net/rocker/rocker_of_dpa.c @@ -368,9 +368,6 @@ static OfDpaFlow *of_dpa_flow_alloc(uint64_t cookie) int64_t now = qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) / 1000; flow = g_new0(OfDpaFlow, 1); - if (!flow) { - return NULL; - } flow->cookie = cookie; flow->mask.tbl_id = 0xffffffff; @@ -813,10 +810,6 @@ static OfDpaGroup *of_dpa_group_alloc(uint32_t id) { OfDpaGroup *group = g_new0(OfDpaGroup, 1); - if (!group) { - return NULL; - } - group->id = id; return group; @@ -1867,9 +1860,6 @@ static int of_dpa_cmd_flow_add(OfDpa *of_dpa, uint64_t cookie, } flow = of_dpa_flow_alloc(cookie); - if (!flow) { - return -ROCKER_ENOMEM; - } err = of_dpa_cmd_flow_add_mod(of_dpa, flow, flow_tlvs); if (err) { @@ -2040,17 +2030,10 @@ static int of_dpa_cmd_add_l2_flood(OfDpa *of_dpa, OfDpaGroup *group, rocker_tlv_get_le16(group_tlvs[ROCKER_TLV_OF_DPA_GROUP_COUNT]); tlvs = g_new0(RockerTlv *, group->l2_flood.group_count + 1); - if (!tlvs) { - return -ROCKER_ENOMEM; - } g_free(group->l2_flood.group_ids); group->l2_flood.group_ids = g_new0(uint32_t, group->l2_flood.group_count); - if (!group->l2_flood.group_ids) { - err = -ROCKER_ENOMEM; - goto err_out; - } rocker_tlv_parse_nested(tlvs, group->l2_flood.group_count, group_tlvs[ROCKER_TLV_OF_DPA_GROUP_IDS]); @@ -2157,9 +2140,6 @@ static int of_dpa_cmd_group_add(OfDpa *of_dpa, uint32_t group_id, } group = of_dpa_group_alloc(group_id); - if (!group) { - return -ROCKER_ENOMEM; - } err = of_dpa_cmd_group_do(of_dpa, group_id, group, group_tlvs); if (err) { |