Received: from eggs.gnu.org ([2001:4830:134:3::10]:46933) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPQos-0001Mg-Vj for qemu-devel@nongnu.org; Tue, 19 Jul 2016 04:56:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPQos-0007mp-4Z for qemu-devel@nongnu.org; Tue, 19 Jul 2016 04:56:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53366) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPQor-0007me-Uw for qemu-devel@nongnu.org; Tue, 19 Jul 2016 04:56:02 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7F95EC04B304 for ; Tue, 19 Jul 2016 08:56:01 +0000 (UTC) From: marcandre.lureau@redhat.com Date: Tue, 19 Jul 2016 12:54:21 +0400 Message-Id: <20160719085432.4572-27-marcandre.lureau@redhat.com> In-Reply-To: <20160719085432.4572-1-marcandre.lureau@redhat.com> References: <20160719085432.4572-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 26/37] sd: free timer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= From: Marc-Andr=C3=A9 Lureau Free the timer allocated in instance_init. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/sd/sd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 87c6dc1..8e88e83 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1876,6 +1876,14 @@ static void sd_instance_init(Object *obj) sd->ocr_power_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, sd_ocr_powe= rup, sd); } =20 +static void sd_instance_finalize(Object *obj) +{ + SDState *sd =3D SD_CARD(obj); + + timer_del(sd->ocr_power_timer); + timer_free(sd->ocr_power_timer); +} + static void sd_realize(DeviceState *dev, Error **errp) { SDState *sd =3D SD_CARD(dev); @@ -1927,6 +1935,7 @@ static const TypeInfo sd_info =3D { .class_size =3D sizeof(SDCardClass), .class_init =3D sd_class_init, .instance_init =3D sd_instance_init, + .instance_finalize =3D sd_instance_finalize, }; =20 static void sd_register_types(void) --=20 2.9.0