From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkKhd-00078n-VU for qemu-devel@nongnu.org; Thu, 08 Oct 2015 19:35:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkKhG-0001aO-59 for qemu-devel@nongnu.org; Thu, 08 Oct 2015 19:34:25 -0400 References: <1444332916-16476-1-git-send-email-thuth@redhat.com> <1444332916-16476-4-git-send-email-thuth@redhat.com> From: Eric Blake Message-ID: <5616FD68.5050801@redhat.com> Date: Thu, 8 Oct 2015 17:34:00 -0600 MIME-Version: 1.0 In-Reply-To: <1444332916-16476-4-git-send-email-thuth@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mLkkPfNiRijDJeU0L4xUiiBc0CFlkCMA6" Subject: Re: [Qemu-devel] [PATCH 3/5] hw/input/tsc210x: Remove superfluous memset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --mLkkPfNiRijDJeU0L4xUiiBc0CFlkCMA6 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/08/2015 01:35 PM, Thomas Huth wrote: > 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. >=20 > Signed-off-by: Thomas Huth > --- > hw/input/tsc210x.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) >=20 > 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; > =20 > - s =3D (TSC210xState *) > - g_malloc0(sizeof(TSC210xState)); > - memset(s, 0, sizeof(TSC210xState)); > + s =3D g_malloc0(sizeof(TSC210xState)); This should probably be g_new0(TSC210xState, 1), consistent with Markus' recent cleanup patches. > s->x =3D 160; > s->y =3D 160; > s->pressure =3D 0; > @@ -1135,9 +1133,7 @@ uWireSlave *tsc2301_init(qemu_irq penirq, qemu_ir= q kbirq, qemu_irq dav) > { > TSC210xState *s; > =20 > - s =3D (TSC210xState *) > - g_malloc0(sizeof(TSC210xState)); > - memset(s, 0, sizeof(TSC210xState)); > + s =3D g_malloc0(sizeof(TSC210xState)); Likewise. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --mLkkPfNiRijDJeU0L4xUiiBc0CFlkCMA6 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWFv1oAAoJEKeha0olJ0Nq9/UH/1wbuGMmJV2S95pFPSRpMeDo hQpbPY3XSzogec8F1R6upuIeMsbU6oqRL2sX0SUujGO8m8ZAdnz9uTy7LxiDJ5qZ 9a8wjWwWbnu/A737Se570fUv5zNXSqgWYHP4YRw0ksLHinclJc0LHqgmUWZ31yno jTnI29hL3QGaI6z7YgYKebOXPL3kbcMrdkFLZ4aJcEJTuFc4H3HWAiYWVd5xLAz+ vXvNJj8gcB1tYrSo634akiS1pQpSr0j3n7xXn7eYJnZUlqrAMUUv4qcVgYpiVH5t m7tKTGzLLIMfYNZ1QebMlr7iFhFGYJkLVmHtdQDLJ37i+cONoMtxXJyZ/byhueU= =W81Z -----END PGP SIGNATURE----- --mLkkPfNiRijDJeU0L4xUiiBc0CFlkCMA6--