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>
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;
}
list_for_each_entry(p, &_manager->pools, pools) {
unsigned nr_free;
- if (!p && !p->dev)
+ if (!p->dev)
continue;
if (shrink_pages == 0)
break;