From: Keir Fraser <keir.fraser@eu.citrix.com>
To: Samuel Thibault <samuel.thibault@eu.citrix.com>,
xen-devel@lists.xensource.com
Subject: Re: [PATCH] minios: free fbfront resources on error/shutdown
Date: Mon, 12 May 2008 11:17:47 +0100 [thread overview]
Message-ID: <C44DD7DB.20836%keir.fraser@eu.citrix.com> (raw)
In-Reply-To: <20080512101146.GD5753@implementation.visiteurs.inrialpes.fr>
Doesn't apply to xen-unstable tip c/s 17616.
-- Keir
On 12/5/08 11:11, "Samuel Thibault" <samuel.thibault@eu.citrix.com> wrote:
> minios: free fbfront resources on error/shutdown
>
> Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
>
> diff -r b0d7780794eb extras/mini-os/fbfront.c
> --- a/extras/mini-os/fbfront.c Thu May 08 13:40:40 2008 +0100
> +++ b/extras/mini-os/fbfront.c Mon May 12 12:10:30 2008 +0200
> @@ -47,6 +47,20 @@
> files[fd].read = 1;
> #endif
> wake_up(&kbdfront_queue);
> +}
> +
> +static void free_kbdfront(struct kbdfront_dev *dev)
> +{
> + mask_evtchn(dev->evtchn);
> +
> + free(dev->backend);
> +
> + free_page(dev->page);
> +
> + unbind_evtchn(dev->evtchn);
> +
> + free(dev->nodename);
> + free(dev);
> }
>
> struct kbdfront_dev *init_kbdfront(char *nodename, int abs_pointer)
> @@ -122,7 +136,7 @@
>
> abort_transaction:
> xenbus_transaction_end(xbt, 1, &retry);
> - return NULL;
> + goto error;
>
> done:
>
> @@ -130,7 +144,7 @@
> msg = xenbus_read(XBT_NIL, path, &dev->backend);
> if (msg) {
> printk("Error %s when reading the backend path %s\n", msg, path);
> - return NULL;
> + goto error;
> }
>
> printk("backend at %s\n", dev->backend);
> @@ -153,6 +167,9 @@
> printk("************************** KBDFRONT\n");
>
> return dev;
> +error:
> + free_kbdfront(dev);
> + return NULL;
> }
>
> int kbdfront_receive(struct kbdfront_dev *dev, union xenkbd_in_event *buf,
> int n)
> @@ -208,12 +225,7 @@
>
> xenbus_unwatch_path(XBT_NIL, path);
>
> - unbind_evtchn(dev->evtchn);
> -
> - free_pages(dev->page,0);
> - free(nodename);
> - free(dev->backend);
> - free(dev);
> + free_kbdfront(dev);
> }
>
> #ifdef HAVE_LIBC
> @@ -260,6 +272,20 @@
> void fbfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
> {
> wake_up(&fbfront_queue);
> +}
> +
> +static void free_fbfront(struct fbfront_dev *dev)
> +{
> + mask_evtchn(dev->evtchn);
> +
> + free(dev->backend);
> +
> + free_page(dev->page);
> +
> + unbind_evtchn(dev->evtchn);
> +
> + free(dev->nodename);
> + free(dev);
> }
>
> struct fbfront_dev *init_fbfront(char *nodename, unsigned long *mfns, int
> width, int height, int depth, int stride, int n)
> @@ -357,7 +383,7 @@
>
> abort_transaction:
> xenbus_transaction_end(xbt, 1, &retry);
> - return NULL;
> + goto error;
>
> done:
>
> @@ -365,7 +391,7 @@
> msg = xenbus_read(XBT_NIL, path, &dev->backend);
> if (msg) {
> printk("Error %s when reading the backend path %s\n", msg, path);
> - return NULL;
> + goto error;
> }
>
> printk("backend at %s\n", dev->backend);
> @@ -391,6 +417,10 @@
> printk("************************** FBFRONT\n");
>
> return dev;
> +
> +error:
> + free_fbfront(dev);
> + return NULL;
> }
>
> static void fbfront_out_event(struct fbfront_dev *dev, union xenfb_out_event
> *event)
> @@ -477,7 +507,7 @@
>
> unbind_evtchn(dev->evtchn);
>
> - free_pages(dev->page,0);
> + free_page(dev->page);
> free(nodename);
> free(dev->backend);
> free(dev);
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2008-05-12 10:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-12 9:34 [PATCH] minios: free netfront resources on error/shutdown Samuel Thibault
2008-05-12 9:59 ` minios: free blkfront " Samuel Thibault
2008-05-12 10:11 ` [PATCH] minios: free fbfront " Samuel Thibault
2008-05-12 10:17 ` Keir Fraser [this message]
2008-05-12 12:16 ` Samuel Thibault
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=C44DD7DB.20836%keir.fraser@eu.citrix.com \
--to=keir.fraser@eu.citrix.com \
--cc=samuel.thibault@eu.citrix.com \
--cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.