summaryrefslogtreecommitdiffstats
path: root/hw/input/tsc210x.c
diff options
context:
space:
mode:
authorThomas Huth2015-10-09 17:56:36 +0200
committerMichael Tokarev2015-11-06 13:42:38 +0100
commita6c6d827605e416f0e127a325ee1efc9cf16afa5 (patch)
tree82db55296e541a12ac3da5a002e662f044cf9f11 /hw/input/tsc210x.c
parentxen: fix invalid assertion (diff)
downloadqemu-a6c6d827605e416f0e127a325ee1efc9cf16afa5.tar.gz
qemu-a6c6d827605e416f0e127a325ee1efc9cf16afa5.tar.xz
qemu-a6c6d827605e416f0e127a325ee1efc9cf16afa5.zip
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: Thomas Huth <thuth@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw/input/tsc210x.c')
-rw-r--r--hw/input/tsc210x.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/hw/input/tsc210x.c b/hw/input/tsc210x.c
index fae3385636..1073bbfec6 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_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;