From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkRM3-0003fN-Jr for qemu-devel@nongnu.org; Fri, 09 Oct 2015 02:40:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkRLy-0005SP-KT for qemu-devel@nongnu.org; Fri, 09 Oct 2015 02:40:35 -0400 References: <1444332916-16476-1-git-send-email-thuth@redhat.com> <1444332916-16476-4-git-send-email-thuth@redhat.com> <5616FD68.5050801@redhat.com> From: Thomas Huth Message-ID: <5617615B.5050805@redhat.com> Date: Fri, 9 Oct 2015 08:40:27 +0200 MIME-Version: 1.0 In-Reply-To: <5616FD68.5050801@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ls2UfbsNbmP6ErVmIRXwpBWaTCTqMW45R" 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: Eric Blake , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ls2UfbsNbmP6ErVmIRXwpBWaTCTqMW45R Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/10/15 01:34, Eric Blake wrote: > 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. >> >> 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; >> =20 >> - s =3D (TSC210xState *) >> - g_malloc0(sizeof(TSC210xState)); >> - memset(s, 0, sizeof(TSC210xState)); >> + s =3D g_malloc0(sizeof(TSC210xState)); >=20 > This should probably be g_new0(TSC210xState, 1), consistent with Markus= ' > recent cleanup patches. Ok, I'll change my patch. Thomas --ls2UfbsNbmP6ErVmIRXwpBWaTCTqMW45R 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.0.22 (GNU/Linux) iQIcBAEBAgAGBQJWF2FbAAoJEC7Z13T+cC216skP/0EHHRyVnXnMr65jUKWQjnDj rX1z6XTDINhgCHyGDsk1/rIrjRxi+0AaqxNszw/EtA7HFN4JrqGjP4HSHlbCDhPu 2yxqfuD0EIK3W1yutdNmIujMuh9IwFQvqt8jD/hbtXZ5dS/yicWHk30oRgFlOvCx L72IDX5vGgGMgoN4NxuRyfP9IMVXUreLkLKxJrKivHK4ZyvUB18yp83m4vnnPpNP grLJ+0Luu0mOClCjy1JENXZYAfADyj8UPmgsX6e1VC1kPh5QHdcbtdn+E/HxPPzL ZF3VeEOO3HxyZ5Jp2/ND6dKOguHotSFIOTEf1lfpUE/EkN6yHh1GN9KEBJHu3bJe j3JToErdvFdJX9z3r24WHg5UTsjz1S82Lz3mhfsZ4joYmei0qh54XsocwJj76+vb ekGv/qXEziS+2opb3nqvu05qGRirnKyXLA+h8mXN6/zsBqiXXfgtkssMnu4tY0hm S8EApOSyu0PPP83Ay61sSKOVPZiAUcluzoDW/tbQa2+Bd6kDTkUoM9g9fcOtYiLR 0VtqaM2rH5LtAYhtyUNzC2PIxoFKU+UEY0Qe5pFDRl21lGloHuKsUVsg8NciTOwM JRUdwOksPeVOPMG55tqYzKmJlVJGvA4UCQR7gN+zJIqmJllz1KUCIs0AD6i8cS2v u3dCrIxMf/v7Jai4b/lP =K3yi -----END PGP SIGNATURE----- --ls2UfbsNbmP6ErVmIRXwpBWaTCTqMW45R--