diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2012-04-15 05:27:12 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-04-17 00:29:32 -0400 |
commit | 6b5e7d9ef793c55d72679f058514f33c4258f286 (patch) | |
tree | bf1141323d954701cabe8059f3afbabd813da813 /drivers/xen | |
parent | f09d8432e39797abf39531f41ac8a46a3fbf442a (diff) |
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@lip6.fr>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/grant-table.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 1cd94daa71db..f805918a993f 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
@@ -1026,6 +1026,7 @@ int gnttab_init(void) | |||
1026 | int i; | 1026 | int i; |
1027 | unsigned int max_nr_glist_frames, nr_glist_frames; | 1027 | unsigned int max_nr_glist_frames, nr_glist_frames; |
1028 | unsigned int nr_init_grefs; | 1028 | unsigned int nr_init_grefs; |
1029 | int ret; | ||
1029 | 1030 | ||
1030 | nr_grant_frames = 1; | 1031 | nr_grant_frames = 1; |
1031 | boot_max_nr_grant_frames = __max_nr_grant_frames(); | 1032 | boot_max_nr_grant_frames = __max_nr_grant_frames(); |
@@ -1044,12 +1045,16 @@ int gnttab_init(void) | |||
1044 | nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; | 1045 | nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; |
1045 | for (i = 0; i < nr_glist_frames; i++) { | 1046 | for (i = 0; i < nr_glist_frames; i++) { |
1046 | gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); | 1047 | gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); |
1047 | if (gnttab_list[i] == NULL) | 1048 | if (gnttab_list[i] == NULL) { |
1049 | ret = -ENOMEM; | ||
1048 | goto ini_nomem; | 1050 | goto ini_nomem; |
1051 | } | ||
1049 | } | 1052 | } |
1050 | 1053 | ||
1051 | if (gnttab_resume() < 0) | 1054 | if (gnttab_resume() < 0) { |
1052 | return -ENODEV; | 1055 | ret = -ENODEV; |
1056 | goto ini_nomem; | ||
1057 | } | ||
1053 | 1058 | ||
1054 | nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; | 1059 | nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; |
1055 | 1060 | ||
@@ -1067,7 +1072,7 @@ int gnttab_init(void) | |||
1067 | for (i--; i >= 0; i--) | 1072 | for (i--; i >= 0; i--) |
1068 | free_page((unsigned long)gnttab_list[i]); | 1073 | free_page((unsigned long)gnttab_list[i]); |
1069 | kfree(gnttab_list); | 1074 | kfree(gnttab_list); |
1070 | return -ENOMEM; | 1075 | return ret; |
1071 | } | 1076 | } |
1072 | EXPORT_SYMBOL_GPL(gnttab_init); | 1077 | EXPORT_SYMBOL_GPL(gnttab_init); |
1073 | 1078 | ||