]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/char/agp/amd-k7-agp.c
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[linux-2.6-omap-h63xx.git] / drivers / char / agp / amd-k7-agp.c
index 3a41672e4d6682112f19a19ee8ceae2752984be0..e6c534e6284638a610d8a1549b52530d6d4225af 100644 (file)
@@ -94,19 +94,21 @@ static int amd_create_gatt_pages(int nr_tables)
        int retval = 0;
        int i;
 
-       tables = kmalloc((nr_tables + 1) * sizeof(struct amd_page_map *),
-                        GFP_KERNEL);
+       tables = kzalloc((nr_tables + 1) * sizeof(struct amd_page_map *),GFP_KERNEL);
        if (tables == NULL)
                return -ENOMEM;
 
-       memset (tables, 0, sizeof(struct amd_page_map *) * (nr_tables + 1));
        for (i = 0; i < nr_tables; i++) {
-               entry = kmalloc(sizeof(struct amd_page_map), GFP_KERNEL);
+               entry = kzalloc(sizeof(struct amd_page_map), GFP_KERNEL);
                if (entry == NULL) {
+                       while (i > 0) {
+                               kfree(tables[i-1]);
+                               i--;
+                       }
+                       kfree(tables);
                        retval = -ENOMEM;
                        break;
                }
-               memset (entry, 0, sizeof(struct amd_page_map));
                tables[i] = entry;
                retval = amd_create_page_map(entry);
                if (retval != 0)
@@ -121,7 +123,7 @@ static int amd_create_gatt_pages(int nr_tables)
        return retval;
 }
 
-/* Since we don't need contigious memory we just try
+/* Since we don't need contiguous memory we just try
  * to get the gatt table once
  */
 
@@ -342,7 +344,7 @@ static int amd_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
        return 0;
 }
 
-static struct aper_size_info_lvl2 amd_irongate_sizes[7] =
+static const struct aper_size_info_lvl2 amd_irongate_sizes[7] =
 {
        {2048, 524288, 0x0000000c},
        {1024, 262144, 0x0000000a},
@@ -353,12 +355,12 @@ static struct aper_size_info_lvl2 amd_irongate_sizes[7] =
        {32, 8192, 0x00000000}
 };
 
-static struct gatt_mask amd_irongate_masks[] =
+static const struct gatt_mask amd_irongate_masks[] =
 {
        {.mask = 1, .type = 0}
 };
 
-static struct agp_bridge_driver amd_irongate_driver = {
+static const struct agp_bridge_driver amd_irongate_driver = {
        .owner                  = THIS_MODULE,
        .aperture_sizes         = amd_irongate_sizes,
        .size_type              = LVL2_APER_SIZE,
@@ -379,6 +381,7 @@ static struct agp_bridge_driver amd_irongate_driver = {
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
 static struct agp_device_ids amd_agp_device_ids[] __devinitdata =