diff options
-rw-r--r-- | drivers/char/agp/amd-k7-agp.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c index f60bca70d1fb..1405a42585e1 100644 --- a/drivers/char/agp/amd-k7-agp.c +++ b/drivers/char/agp/amd-k7-agp.c | |||
@@ -100,21 +100,16 @@ static int amd_create_gatt_pages(int nr_tables) | |||
100 | 100 | ||
101 | for (i = 0; i < nr_tables; i++) { | 101 | for (i = 0; i < nr_tables; i++) { |
102 | entry = kzalloc(sizeof(struct amd_page_map), GFP_KERNEL); | 102 | entry = kzalloc(sizeof(struct amd_page_map), GFP_KERNEL); |
103 | tables[i] = entry; | ||
103 | if (entry == NULL) { | 104 | if (entry == NULL) { |
104 | while (i > 0) { | ||
105 | kfree(tables[i-1]); | ||
106 | i--; | ||
107 | } | ||
108 | kfree(tables); | ||
109 | retval = -ENOMEM; | 105 | retval = -ENOMEM; |
110 | break; | 106 | break; |
111 | } | 107 | } |
112 | tables[i] = entry; | ||
113 | retval = amd_create_page_map(entry); | 108 | retval = amd_create_page_map(entry); |
114 | if (retval != 0) | 109 | if (retval != 0) |
115 | break; | 110 | break; |
116 | } | 111 | } |
117 | amd_irongate_private.num_tables = nr_tables; | 112 | amd_irongate_private.num_tables = i; |
118 | amd_irongate_private.gatt_pages = tables; | 113 | amd_irongate_private.gatt_pages = tables; |
119 | 114 | ||
120 | if (retval != 0) | 115 | if (retval != 0) |