Skip to content

Commit

Permalink
drm/ttm: fix condition (and vs or)
Browse files Browse the repository at this point in the history
The "if (!p && !p->dev)" condition isn't right because || was intended
instead of &&.  But actually, "p" is the list cursor and so it's always
non-NULL and we can just remove that bit.  We can remove the another
similar check as well.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Dan Carpenter authored and Dave Airlie committed Jan 10, 2012
1 parent a7eef88 commit 7920aa5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -933,10 +933,8 @@ static int ttm_dma_pool_get_num_unused_pages(void)
unsigned total = 0;

mutex_lock(&_manager->lock);
list_for_each_entry(p, &_manager->pools, pools) {
if (p)
total += p->pool->npages_free;
}
list_for_each_entry(p, &_manager->pools, pools)
total += p->pool->npages_free;
mutex_unlock(&_manager->lock);
return total;
}
Expand Down Expand Up @@ -1031,7 +1029,7 @@ static int ttm_dma_pool_mm_shrink(struct shrinker *shrink,
list_for_each_entry(p, &_manager->pools, pools) {
unsigned nr_free;

if (!p && !p->dev)
if (!p->dev)
continue;
if (shrink_pages == 0)
break;
Expand Down

0 comments on commit 7920aa5

Please sign in to comment.