WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] minios: free fbfront resources on error/s

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] minios: free fbfront resources on error/shutdown
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 13 May 2008 08:30:15 -0700
Delivery-date: Tue, 13 May 2008 08:30:17 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1210668472 -3600
# Node ID 3ea09a104f5a51bff2aaefc78df396bf6be945af
# Parent  2ab64478bd81d808b453e0f7d9f85b1515dc7acf
minios: free fbfront resources on error/shutdown

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
---
 extras/mini-os/fbfront.c |   55 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 41 insertions(+), 14 deletions(-)

diff -r 2ab64478bd81 -r 3ea09a104f5a extras/mini-os/fbfront.c
--- a/extras/mini-os/fbfront.c  Tue May 13 09:21:28 2008 +0100
+++ b/extras/mini-os/fbfront.c  Tue May 13 09:47:52 2008 +0100
@@ -49,6 +49,20 @@ void kbdfront_handler(evtchn_port_t port
     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)
 {
     xenbus_transaction_t xbt;
@@ -122,7 +136,7 @@ again:
 
 abort_transaction:
     xenbus_transaction_end(xbt, 1, &retry);
-    return NULL;
+    goto error;
 
 done:
 
@@ -130,7 +144,7 @@ done:
     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 @@ done:
     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 @@ void shutdown_kbdfront(struct kbdfront_d
 
     xenbus_unwatch_path(XBT_NIL, path);
 
-    unbind_evtchn(dev->evtchn);
-
-    free_page(dev->page);
-    free(nodename);
-    free(dev->backend);
-    free(dev);
+    free_kbdfront(dev);
 }
 
 #ifdef HAVE_LIBC
@@ -270,6 +282,20 @@ void fbfront_handler(evtchn_port_t port,
     files[fd].read = 1;
 #endif
     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);
 }
 
 int fbfront_receive(struct fbfront_dev *dev, union xenfb_in_event *buf, int n)
@@ -401,7 +427,7 @@ again:
 
 abort_transaction:
     xenbus_transaction_end(xbt, 1, &retry);
-    return NULL;
+    goto error;
 
 done:
 
@@ -409,7 +435,7 @@ done:
     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);
@@ -435,6 +461,10 @@ done:
     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)
@@ -521,10 +551,7 @@ void shutdown_fbfront(struct fbfront_dev
 
     unbind_evtchn(dev->evtchn);
 
-    free_page(dev->page);
-    free(nodename);
-    free(dev->backend);
-    free(dev);
+    free_fbfront(dev);
 }
 
 #ifdef HAVE_LIBC

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] minios: free fbfront resources on error/shutdown, Xen patchbot-unstable <=