Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 185495
b: refs/heads/master
c: 290e550
h: refs/heads/master
i:
  185493: f97c909
  185491: f831ada
  185487: e6de337
v: v3
  • Loading branch information
Maarten Maathuis authored and Dave Airlie committed Feb 25, 2010
1 parent ff64b9c commit f936d96
Show file tree
Hide file tree
Showing 2 changed files with 12 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: 6a8a2d702b33c6ed5c789f21b4e89fdf221f01ca
refs/heads/master: 290e55056ec3d25c72088628245d8cae037b30db
18 changes: 11 additions & 7 deletions trunk/drivers/gpu/drm/ttm/ttm_tt.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ static int ttm_tt_swapin(struct ttm_tt *ttm)
void *from_virtual;
void *to_virtual;
int i;
int ret;
int ret = -ENOMEM;

if (ttm->page_flags & TTM_PAGE_FLAG_USER) {
ret = ttm_tt_set_user(ttm, ttm->tsk, ttm->start,
Expand All @@ -495,8 +495,10 @@ static int ttm_tt_swapin(struct ttm_tt *ttm)

for (i = 0; i < ttm->num_pages; ++i) {
from_page = read_mapping_page(swap_space, i, NULL);
if (IS_ERR(from_page))
if (IS_ERR(from_page)) {
ret = PTR_ERR(from_page);
goto out_err;
}
to_page = __ttm_tt_get_page(ttm, i);
if (unlikely(to_page == NULL))
goto out_err;
Expand All @@ -519,7 +521,7 @@ static int ttm_tt_swapin(struct ttm_tt *ttm)
return 0;
out_err:
ttm_tt_free_alloced_pages(ttm);
return -ENOMEM;
return ret;
}

int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage)
Expand All @@ -531,6 +533,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage)
void *from_virtual;
void *to_virtual;
int i;
int ret = -ENOMEM;

BUG_ON(ttm->state != tt_unbound && ttm->state != tt_unpopulated);
BUG_ON(ttm->caching_state != tt_cached);
Expand All @@ -553,7 +556,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage)
0);
if (unlikely(IS_ERR(swap_storage))) {
printk(KERN_ERR "Failed allocating swap storage.\n");
return -ENOMEM;
return PTR_ERR(swap_storage);
}
} else
swap_storage = persistant_swap_storage;
Expand All @@ -565,9 +568,10 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage)
if (unlikely(from_page == NULL))
continue;
to_page = read_mapping_page(swap_space, i, NULL);
if (unlikely(to_page == NULL))
if (unlikely(IS_ERR(to_page))) {
ret = PTR_ERR(to_page);
goto out_err;

}
preempt_disable();
from_virtual = kmap_atomic(from_page, KM_USER0);
to_virtual = kmap_atomic(to_page, KM_USER1);
Expand All @@ -591,5 +595,5 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage)
if (!persistant_swap_storage)
fput(swap_storage);

return -ENOMEM;
return ret;
}

0 comments on commit f936d96

Please sign in to comment.