From: "Marc-André Lureau" <mlureau@redhat.com>
To: minyard@acm.org
Cc: qemu-devel@nongnu.org, Corey Minyard <cminyard@mvista.com>,
"Richard W . M . Jones" <rjones@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/3] wdt_ib700: Free timer
Date: Fri, 22 Jul 2016 05:26:27 -0400 (EDT) [thread overview]
Message-ID: <159615513.7263211.1469179587817.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1469119749-31181-4-git-send-email-minyard@acm.org>
Hi
----- Original Message -----
> From: Corey Minyard <cminyard@mvista.com>
>
> Add an unrealize function to free the timer allocated in the
> realize function and to delete the port memory added there,
> too.
>
> Signed-off-by: Corey Minyard <cminyard@mvista.com>
> Cc: Richard W.M. Jones <rjones@redhat.com>
> Cc: Marc-André Lureau <mlureau@redhat.com>
> Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
> ---
> hw/watchdog/wdt_ib700.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> 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, Error
> **errp)
> portio_list_add(&s->port_list, isa_address_space_io(&s->parent_obj), 0);
> }
>
> +static void wdt_ib700_unrealize(DeviceState *dev, Error **errp)
> +{
> + IB700State *s = 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 allocations)
btw, I do not how to test this yet either.
> +}
> +
> static void wdt_ib700_reset(DeviceState *dev)
> {
> IB700State *s = IB700(dev);
> @@ -136,6 +145,7 @@ static void wdt_ib700_class_init(ObjectClass *klass, void
> *data)
> DeviceClass *dc = DEVICE_CLASS(klass);
>
> dc->realize = wdt_ib700_realize;
> + dc->unrealize = wdt_ib700_unrealize;
> dc->reset = wdt_ib700_reset;
> dc->vmsd = &vmstate_ib700;
> set_bit(DEVICE_CATEGORY_MISC, dc->categories);
> --
> 2.7.4
>
>
next prev parent reply other threads:[~2016-07-22 9:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-21 16:49 [Qemu-devel] [PATCH v2 0/3] Handle freeing data in some devices minyard
2016-07-21 16:49 ` [Qemu-devel] [PATCH v2 1/3] ipmi_bmc_sim: Add a proper unrealize function minyard
2016-07-22 9:22 ` Marc-André Lureau
2016-07-22 12:14 ` Corey Minyard
2016-07-21 16:49 ` [Qemu-devel] [PATCH v2 2/3] wdt_i6300esb: Free timer minyard
2016-07-21 16:49 ` [Qemu-devel] [PATCH v2 3/3] wdt_ib700: " minyard
2016-07-22 9:26 ` Marc-André Lureau [this message]
2016-07-22 10:12 ` Richard W.M. Jones
2016-07-22 12:12 ` Corey Minyard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=159615513.7263211.1469179587817.JavaMail.zimbra@redhat.com \
--to=mlureau@redhat.com \
--cc=cminyard@mvista.com \
--cc=minyard@acm.org \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).