Commit a6c6d827 authored by Thomas Huth's avatar Thomas Huth Committed by Michael Tokarev
Browse files

hw/input/tsc210x: Remove superfluous memset



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
and use the type-safe g_new0 instead.

Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Signed-off-by: default avatarMichael Tokarev <mjt@tls.msk.ru>
parent 2c21ec3d
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -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_new0(TSC210xState, 1);
    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_new0(TSC210xState, 1);
    s->x = 400;
    s->y = 240;
    s->pressure = 0;