From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkGyU-0004cG-27 for qemu-devel@nongnu.org; Thu, 08 Oct 2015 15:35:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkGyP-0006Gy-DK for qemu-devel@nongnu.org; Thu, 08 Oct 2015 15:35:33 -0400 From: Thomas Huth Date: Thu, 8 Oct 2015 21:35:14 +0200 Message-Id: <1444332916-16476-4-git-send-email-thuth@redhat.com> In-Reply-To: <1444332916-16476-1-git-send-email-thuth@redhat.com> References: <1444332916-16476-1-git-send-email-thuth@redhat.com> Subject: [Qemu-devel] [PATCH 3/5] hw/input/tsc210x: Remove superfluous memset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org g_malloc0 already clears the memory, so no need for additional memsets here. And while we're at it, let's also remove the superfluous typecasts for the return values of g_malloc0. Signed-off-by: Thomas Huth --- hw/input/tsc210x.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/input/tsc210x.c b/hw/input/tsc210x.c index fae3385..92b076a 100644 --- a/hw/input/tsc210x.c +++ b/hw/input/tsc210x.c @@ -1086,9 +1086,7 @@ uWireSlave *tsc2102_init(qemu_irq pint) { TSC210xState *s; - s = (TSC210xState *) - g_malloc0(sizeof(TSC210xState)); - memset(s, 0, sizeof(TSC210xState)); + s = g_malloc0(sizeof(TSC210xState)); s->x = 160; s->y = 160; s->pressure = 0; @@ -1135,9 +1133,7 @@ uWireSlave *tsc2301_init(qemu_irq penirq, qemu_irq kbirq, qemu_irq dav) { TSC210xState *s; - s = (TSC210xState *) - g_malloc0(sizeof(TSC210xState)); - memset(s, 0, sizeof(TSC210xState)); + s = g_malloc0(sizeof(TSC210xState)); s->x = 400; s->y = 240; s->pressure = 0; -- 1.8.3.1