|
From: | Mao Zhongyi |
Subject: | Re: [Qemu-devel] [PATCH v5 1/4] net/rocker: Remove the dead error handling |
Date: | Tue, 23 May 2017 18:09:48 +0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
Hi, Markus On 05/23/2017 05:27 PM, Markus Armbruster wrote:
Mao Zhongyi <address@hidden> 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 factdon'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 <address@hidden>Reviewed-by: Markus Armbruster <address@hidden>
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
[Prev in Thread] | Current Thread | [Next in Thread] |