From: Dan Carpenter Date: Thu, 8 Dec 2011 06:50:54 +0000 (+0300) Subject: drm/ttm: fix condition (and vs or) X-Git-Tag: firefly_0821_release~3680^2~3773^2~2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7920aa5a9d841fc7a10ff53a5a775f821d7a6ba1;p=firefly-linux-kernel-4.4.55.git 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 Reviewed-by: Jerome Glisse Acked-by: Konrad Rzeszutek Wilk Signed-off-by: Dave Airlie --- 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) 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; } @@ -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;