[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] xen/grant-table: add error-handling code on failure of gnttab_resume


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
  • Date: Mon, 14 May 2012 16:29:45 +0000
  • Delivery-date: Mon, 14 May 2012 16:29:51 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Julia Lawall <Julia.Lawall@xxxxxxx>
# Date 1336476488 -7200
# Node ID 7ba94caa95963bacd3557d276ea3362e566fb308
# Parent  f523a98343a9e20e88cde7a6af9cf7e4415ec57d
xen/grant-table: add error-handling code on failure of gnttab_resume

Jump to the label ini_nomem as done on the failure of the page allocations
above.

The code at ini_nomem is modified to accommodate different return values.

Signed-off-by: Julia Lawall <Julia.Lawall@xxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Committed-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r f523a98343a9 -r 7ba94caa9596 drivers/xen/core/gnttab.c
--- a/drivers/xen/core/gnttab.c Mon Apr 02 14:47:52 2012 +0200
+++ b/drivers/xen/core/gnttab.c Tue May 08 13:28:08 2012 +0200
@@ -805,7 +805,7 @@ static int gnttab_expand(unsigned int re
 
 int __devinit gnttab_init(void)
 {
-       int i;
+       int i, ret;
        unsigned int max_nr_glist_frames, nr_glist_frames;
        unsigned int nr_init_grefs;
 
@@ -828,12 +828,16 @@ int __devinit gnttab_init(void)
        nr_glist_frames = nr_freelist_frames(nr_grant_frames);
        for (i = 0; i < nr_glist_frames; i++) {
                gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL);
-               if (gnttab_list[i] == NULL)
+               if (gnttab_list[i] == NULL) {
+                       ret = -ENOMEM;
                        goto ini_nomem;
+               }
        }
 
-       if (gnttab_resume() < 0)
-               return -ENODEV;
+       if (gnttab_resume() < 0) {
+               ret = -ENODEV;
+               goto ini_nomem;
+       }
 
        nr_init_grefs = nr_grant_frames * ENTRIES_PER_GRANT_FRAME;
 
@@ -850,7 +854,7 @@ int __devinit gnttab_init(void)
        for (i--; i >= 0; i--)
                free_page((unsigned long)gnttab_list[i]);
        kfree(gnttab_list);
-       return -ENOMEM;
+       return ret;
 }
 
 #ifdef CONFIG_XEN

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.