diff options
Diffstat (limited to 'drivers/char/agp/ati-agp.c')
-rw-r--r-- | drivers/char/agp/ati-agp.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c index 780e59e588ad..2d46b713c8f2 100644 --- a/drivers/char/agp/ati-agp.c +++ b/drivers/char/agp/ati-agp.c | |||
@@ -123,21 +123,16 @@ static int ati_create_gatt_pages(int nr_tables) | |||
123 | 123 | ||
124 | for (i = 0; i < nr_tables; i++) { | 124 | for (i = 0; i < nr_tables; i++) { |
125 | entry = kzalloc(sizeof(struct ati_page_map), GFP_KERNEL); | 125 | entry = kzalloc(sizeof(struct ati_page_map), GFP_KERNEL); |
126 | tables[i] = entry; | ||
126 | if (entry == NULL) { | 127 | if (entry == NULL) { |
127 | while (i > 0) { | ||
128 | kfree(tables[i-1]); | ||
129 | i--; | ||
130 | } | ||
131 | kfree(tables); | ||
132 | retval = -ENOMEM; | 128 | retval = -ENOMEM; |
133 | break; | 129 | break; |
134 | } | 130 | } |
135 | tables[i] = entry; | ||
136 | retval = ati_create_page_map(entry); | 131 | retval = ati_create_page_map(entry); |
137 | if (retval != 0) | 132 | if (retval != 0) |
138 | break; | 133 | break; |
139 | } | 134 | } |
140 | ati_generic_private.num_tables = nr_tables; | 135 | ati_generic_private.num_tables = i; |
141 | ati_generic_private.gatt_pages = tables; | 136 | ati_generic_private.gatt_pages = tables; |
142 | 137 | ||
143 | if (retval != 0) | 138 | if (retval != 0) |
@@ -218,6 +213,9 @@ static int ati_configure(void) | |||
218 | temp = (temp & 0xfffff000); | 213 | temp = (temp & 0xfffff000); |
219 | ati_generic_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096); | 214 | ati_generic_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096); |
220 | 215 | ||
216 | if (!ati_generic_private.registers) | ||
217 | return -ENOMEM; | ||
218 | |||
221 | if (is_r200()) | 219 | if (is_r200()) |
222 | pci_write_config_dword(agp_bridge->dev, ATI_RS100_IG_AGPMODE, 0x20000); | 220 | pci_write_config_dword(agp_bridge->dev, ATI_RS100_IG_AGPMODE, 0x20000); |
223 | else | 221 | else |