Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 175818
b: refs/heads/master
c: 3fc3a6b
h: refs/heads/master
v: v3
  • Loading branch information
Michel Dänzer authored and Benjamin Herrenschmidt committed Dec 9, 2009
1 parent 7b4c1ad commit c291fb2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ceae8cbe94f3127253110e2d01b9334069e93177
refs/heads/master: 3fc3a6b476581d9b47b33fc1349817ce7b66433e
29 changes: 22 additions & 7 deletions trunk/drivers/char/agp/uninorth-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,6 @@ static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start,
void *temp;
int mask_type;

temp = agp_bridge->current_size;
num_entries = A_SIZE_32(temp)->num_entries;

if (type != mem->type)
return -EINVAL;

Expand All @@ -163,6 +160,12 @@ static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start,
return -EINVAL;
}

if (mem->page_count == 0)
return 0;

temp = agp_bridge->current_size;
num_entries = A_SIZE_32(temp)->num_entries;

if ((pg_start + mem->page_count) > num_entries)
return -EINVAL;

Expand Down Expand Up @@ -194,9 +197,6 @@ static int u3_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
u32 *gp;
int mask_type;

temp = agp_bridge->current_size;
num_entries = A_SIZE_32(temp)->num_entries;

if (type != mem->type)
return -EINVAL;

Expand All @@ -206,6 +206,12 @@ static int u3_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
return -EINVAL;
}

if (mem->page_count == 0)
return 0;

temp = agp_bridge->current_size;
num_entries = A_SIZE_32(temp)->num_entries;

if ((pg_start + mem->page_count) > num_entries)
return -EINVAL;

Expand Down Expand Up @@ -234,10 +240,19 @@ int u3_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
{
size_t i;
u32 *gp;
int mask_type;

if (type != mem->type)
return -EINVAL;

if (type != 0 || mem->type != 0)
mask_type = agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type);
if (mask_type != 0) {
/* We know nothing of memory types */
return -EINVAL;
}

if (mem->page_count == 0)
return 0;

gp = (u32 *) &agp_bridge->gatt_table[pg_start];
for (i = 0; i < mem->page_count; ++i)
Expand Down

0 comments on commit c291fb2

Please sign in to comment.