diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2011-12-08 01:50:54 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-01-10 05:00:42 -0500 |
commit | 7920aa5a9d841fc7a10ff53a5a775f821d7a6ba1 (patch) | |
tree | 4604bbb97b3f0a69b5921aa71b804d0c71e9aa98 /drivers/gpu | |
parent | a7eef882a8d37be46459faa5020648af7ccf6ad2 (diff) |
drm/ttm: fix condition (and vs or)
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>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c index 156ddcd304c3..37ead6995c87 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | |||
@@ -933,10 +933,8 @@ static int ttm_dma_pool_get_num_unused_pages(void) | |||
933 | unsigned total = 0; | 933 | unsigned total = 0; |
934 | 934 | ||
935 | mutex_lock(&_manager->lock); | 935 | mutex_lock(&_manager->lock); |
936 | list_for_each_entry(p, &_manager->pools, pools) { | 936 | list_for_each_entry(p, &_manager->pools, pools) |
937 | if (p) | 937 | total += p->pool->npages_free; |
938 | total += p->pool->npages_free; | ||
939 | } | ||
940 | mutex_unlock(&_manager->lock); | 938 | mutex_unlock(&_manager->lock); |
941 | return total; | 939 | return total; |
942 | } | 940 | } |
@@ -1031,7 +1029,7 @@ static int ttm_dma_pool_mm_shrink(struct shrinker *shrink, | |||
1031 | list_for_each_entry(p, &_manager->pools, pools) { | 1029 | list_for_each_entry(p, &_manager->pools, pools) { |
1032 | unsigned nr_free; | 1030 | unsigned nr_free; |
1033 | 1031 | ||
1034 | if (!p && !p->dev) | 1032 | if (!p->dev) |
1035 | continue; | 1033 | continue; |
1036 | if (shrink_pages == 0) | 1034 | if (shrink_pages == 0) |
1037 | break; | 1035 | break; |