Hi, Markus
On 05/23/2017 05:27 PM, Markus Armbruster wrote:
Mao Zhongyi <maozy.f...@cn.fujitsu.com> writes:
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
don't
Will I need to make a separated patch to fix it? or when you merge to
help me repair?
Thanks a lot.
that g_malloc() of 0 bytes returns null. So error checks for these
allocation failure are superfluous. Now, remove them entirely.
Signed-off-by: Mao Zhongyi <maozy.f...@cn.fujitsu.com>
Reviewed-by: Markus Armbruster <arm...@redhat.com>
Thanks for your quick review:)
There's one more cleanup opportunity:
diff --git a/hw/net/rocker/rocker_desc.c b/hw/net/rocker/rocker_desc.c
index ac02797..d0df89a 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;
- }
-
if (pci_dma_read(dev, le64_to_cpu(info->desc.buf_addr), info->buf, size)) {
return NULL;
}
None of the pci_dma_read() calls outside rocker check the return value.
Just as well, because it always returns 0. Please clean this up in a
separate followup patch.
Thanks for the reminder. I just read the code, it's true.
Will fix it right away.
Mao