[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 1/4] hw/dma/pxa2xx: Remove superfluous memset
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 1/4] hw/dma/pxa2xx: Remove superfluous memset |
Date: |
Fri, 9 Oct 2015 16:58:21 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 10/09/2015 09:56 AM, Thomas Huth wrote:
> g_malloc0 already clears the memory, so no need for
> the additional memset here. And while we're at it,
> also convert the g_malloc0 to the preferred g_new0.
>
> Signed-off-by: Thomas Huth <address@hidden>
> ---
> hw/dma/pxa2xx_dma.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Reviewed-by: Eric Blake <address@hidden>
>
> diff --git a/hw/dma/pxa2xx_dma.c b/hw/dma/pxa2xx_dma.c
> index d4501fb..54cdb25 100644
> --- a/hw/dma/pxa2xx_dma.c
> +++ b/hw/dma/pxa2xx_dma.c
> @@ -459,9 +459,8 @@ static int pxa2xx_dma_init(SysBusDevice *sbd)
> return -1;
> }
>
> - s->chan = g_malloc0(sizeof(PXA2xxDMAChannel) * s->channels);
> + s->chan = g_new0(PXA2xxDMAChannel, s->channels);
>
> - memset(s->chan, 0, sizeof(PXA2xxDMAChannel) * s->channels);
> for (i = 0; i < s->channels; i ++)
> s->chan[i].state = DCSR_STOPINTR;
>
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v2 0/4] Small optimizations for code using g_malloc0 + memset/memcpy, Thomas Huth, 2015/10/09
- [Qemu-devel] [PATCH v2 1/4] hw/dma/pxa2xx: Remove superfluous memset, Thomas Huth, 2015/10/09
- Re: [Qemu-devel] [PATCH v2 1/4] hw/dma/pxa2xx: Remove superfluous memset,
Eric Blake <=
- [Qemu-devel] [PATCH v2 3/4] tests/i44fx-test: No need for zeroing memory before memset, Thomas Huth, 2015/10/09
- [Qemu-devel] [PATCH v2 2/4] hw/input/tsc210x: Remove superfluous memset, Thomas Huth, 2015/10/09
- [Qemu-devel] [PATCH v2 4/4] linux-user/syscall: Replace g_malloc0 + memcpy with g_memdup, Thomas Huth, 2015/10/09
- Re: [Qemu-devel] [PATCH v2 0/4] Small optimizations for code using g_malloc0 + memset/memcpy, Michael Tokarev, 2015/10/29