From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQFKv-0003Oj-73 for qemu-devel@nongnu.org; Thu, 21 Jul 2016 10:52:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQFKq-0008SN-AR for qemu-devel@nongnu.org; Thu, 21 Jul 2016 10:52:28 -0400 Received: from mx3-phx2.redhat.com ([209.132.183.24]:45883) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQFKq-0008S9-2Z for qemu-devel@nongnu.org; Thu, 21 Jul 2016 10:52:24 -0400 Date: Thu, 21 Jul 2016 10:52:12 -0400 (EDT) From: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Message-ID: <24199915.7103277.1469112732016.JavaMail.zimbra@redhat.com> In-Reply-To: <1469112292-30548-3-git-send-email-minyard@acm.org> References: <1469112292-30548-1-git-send-email-minyard@acm.org> <1469112292-30548-3-git-send-email-minyard@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 3/3] wdt_ib700: Free timer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: minyard@acm.org Cc: qemu-devel@nongnu.org, Corey Minyard , "Richard W . M . Jones" Hi ----- Original Message ----- > From: Corey Minyard >=20 > Add an unrealize function to free the timer allocated in the > realize function. >=20 > Signed-off-by: Corey Minyard > Cc: Richard W.M. Jones > Cc: Marc-Andr=C3=A9 Lureau > --- > hw/watchdog/wdt_ib700.c | 9 +++++++++ > 1 file changed, 9 insertions(+) >=20 > diff --git a/hw/watchdog/wdt_ib700.c b/hw/watchdog/wdt_ib700.c > index 532afe8..179771a 100644 > --- a/hw/watchdog/wdt_ib700.c > +++ b/hw/watchdog/wdt_ib700.c > @@ -117,6 +117,14 @@ static void wdt_ib700_realize(DeviceState *dev, Erro= r > **errp) > portio_list_add(&s->port_list, isa_address_space_io(&s->parent_obj),= 0); > } > =20 > +static void wdt_ib700_unrealize(DeviceState *dev, Error **errp) > +{ > + IB700State *s =3D IB700(dev); > + > + timer_del(s->timer); > + timer_free(s->timer); > +} > + We may want to call portio_list_del() too here (although this is a dead fun= ction today) > static void wdt_ib700_reset(DeviceState *dev) > { > IB700State *s =3D IB700(dev); > @@ -136,6 +144,7 @@ static void wdt_ib700_class_init(ObjectClass *klass, = void > *data) > DeviceClass *dc =3D DEVICE_CLASS(klass); > =20 > dc->realize =3D wdt_ib700_realize; > + dc->unrealize =3D wdt_ib700_unrealize; > dc->reset =3D wdt_ib700_reset; > dc->vmsd =3D &vmstate_ib700; > set_bit(DEVICE_CATEGORY_MISC, dc->categories); > -- > 2.7.4 >=20 >=20