aboutsummaryrefslogtreecommitdiff
path: root/hw/net/rocker/rocker_desc.c
diff options
context:
space:
mode:
authorMao Zhongyi <maozy.fnst@cn.fujitsu.com>2017-08-14 11:33:07 +0800
committerJason Wang <jasowang@redhat.com>2017-09-08 08:17:37 +0800
commit107e4b352cc309f9bd7588ef1a44549200620078 (patch)
tree50a7dc360ddd299a00f4a694bd56b9c27792e81e /hw/net/rocker/rocker_desc.c
parent6ce310b5356abb7edc3aa8b8b097d0b8cc76f83f (diff)
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_desc.c')
-rw-r--r--hw/net/rocker/rocker_desc.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/hw/net/rocker/rocker_desc.c b/hw/net/rocker/rocker_desc.c
index 6184c40f72..b009da4f89 100644
--- a/hw/net/rocker/rocker_desc.c
+++ b/hw/net/rocker/rocker_desc.c
@@ -65,10 +65,6 @@ char *desc_get_buf(DescInfo *info, bool read_only)
info->buf_size = size;
}
- if (!info->buf) {
- return NULL;
- }
-
pci_dma_read(dev, le64_to_cpu(info->desc.buf_addr), info->buf, size);
return info->buf;
@@ -142,9 +138,6 @@ bool desc_ring_set_size(DescRing *ring, uint32_t size)
ring->head = ring->tail = 0;
ring->info = g_renew(DescInfo, ring->info, size);
- if (!ring->info) {
- return false;
- }
memset(ring->info, 0, size * sizeof(DescInfo));
@@ -345,9 +338,6 @@ DescRing *desc_ring_alloc(Rocker *r, int index)
DescRing *ring;
ring = g_new0(DescRing, 1);
- if (!ring) {
- return NULL;
- }
ring->r = r;
ring->index = index;