public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Jerome Glisse <j.glisse@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jerome Glisse <jglisse@redhat.com>,
	kernel-janitors@vger.kernel.org,
	Thomas Hellstrom <thellstrom@vmware.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [patch] drm/ttm: fix condition (and vs or)
Date: Thu, 08 Dec 2011 15:34:00 +0000	[thread overview]
Message-ID: <20111208153400.GA3179@homer.localdomain> (raw)
In-Reply-To: <20111208065054.GC16735@elgon.mountain>

On Thu, Dec 08, 2011 at 09:50:54AM +0300, Dan Carpenter wrote:
> 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>
> 
> diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> index 6678abc..1cf4c2c 100644
> --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> @@ -930,10 +930,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;
>  }
> @@ -1023,7 +1021,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;
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2011-12-08 15:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-08  6:50 [patch] drm/ttm: fix condition (and vs or) Dan Carpenter
2011-12-08 15:34 ` Jerome Glisse [this message]
2011-12-08 16:53   ` Konrad Rzeszutek Wilk
2011-12-08 16:58     ` David Airlie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111208153400.GA3179@homer.localdomain \
    --to=j.glisse@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jglisse@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=thellstrom@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox