From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQWj4-000563-7q for qemu-devel@nongnu.org; Fri, 22 Jul 2016 05:26:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQWj0-0007KM-SD for qemu-devel@nongnu.org; Fri, 22 Jul 2016 05:26:34 -0400 Received: from mx3-phx2.redhat.com ([209.132.183.24]:38918) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQWj0-0007KI-KQ for qemu-devel@nongnu.org; Fri, 22 Jul 2016 05:26:30 -0400 Date: Fri, 22 Jul 2016 05:26:27 -0400 (EDT) From: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Message-ID: <159615513.7263211.1469179587817.JavaMail.zimbra@redhat.com> In-Reply-To: <1469119749-31181-4-git-send-email-minyard@acm.org> References: <1469119749-31181-1-git-send-email-minyard@acm.org> <1469119749-31181-4-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 v2 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 and to delete the port memory added there, > too. >=20 > Signed-off-by: Corey Minyard > Cc: Richard W.M. Jones > Cc: Marc-Andr=C3=A9 Lureau > Reviewed-by: Richard W.M. Jones > --- > hw/watchdog/wdt_ib700.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) >=20 > diff --git a/hw/watchdog/wdt_ib700.c b/hw/watchdog/wdt_ib700.c > index 532afe8..23d4857 100644 > --- a/hw/watchdog/wdt_ib700.c > +++ b/hw/watchdog/wdt_ib700.c > @@ -117,6 +117,15 @@ 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); > + portio_list_del(&s->port_list); actually portio_list_destroy() seems to be more appropriate (cleaning up al= locations) btw, I do not how to test this yet either. > +} > + > static void wdt_ib700_reset(DeviceState *dev) > { > IB700State *s =3D IB700(dev); > @@ -136,6 +145,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