* [patch] drm/ttm: fix condition (and vs or)
@ 2011-12-08 6:50 Dan Carpenter
2011-12-08 15:34 ` Jerome Glisse
0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2011-12-08 6:50 UTC (permalink / raw)
To: David Airlie; +Cc: Jerome Glisse, kernel-janitors, Thomas Hellstrom, dri-devel
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>
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;
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [patch] drm/ttm: fix condition (and vs or)
2011-12-08 6:50 [patch] drm/ttm: fix condition (and vs or) Dan Carpenter
@ 2011-12-08 15:34 ` Jerome Glisse
2011-12-08 16:53 ` Konrad Rzeszutek Wilk
0 siblings, 1 reply; 4+ messages in thread
From: Jerome Glisse @ 2011-12-08 15:34 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Jerome Glisse, kernel-janitors, Thomas Hellstrom, dri-devel
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
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [patch] drm/ttm: fix condition (and vs or)
2011-12-08 15:34 ` Jerome Glisse
@ 2011-12-08 16:53 ` Konrad Rzeszutek Wilk
2011-12-08 16:58 ` David Airlie
0 siblings, 1 reply; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2011-12-08 16:53 UTC (permalink / raw)
To: Jerome Glisse
Cc: dri-devel, Jerome Glisse, kernel-janitors, Thomas Hellstrom,
Dan Carpenter
On Thu, Dec 08, 2011 at 10:34:00AM -0500, Jerome Glisse wrote:
> 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
Duh!
> > 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>
And Acked-by me.
Jerome, since you have the patches (And are thinking to send a GIT PULL
to Dave) in your tree, could you include this patch in your queue?
Or would you prefer I do at some other point of time?
Thanks!
> >
> > 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
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [patch] drm/ttm: fix condition (and vs or)
2011-12-08 16:53 ` Konrad Rzeszutek Wilk
@ 2011-12-08 16:58 ` David Airlie
0 siblings, 0 replies; 4+ messages in thread
From: David Airlie @ 2011-12-08 16:58 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk
Cc: Thomas Hellstrom, kernel-janitors, dri-devel, Jerome Glisse,
Dan Carpenter
----- Original Message -----
> From: "Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>
> To: "Jerome Glisse" <j.glisse@gmail.com>
> Cc: dri-devel@lists.freedesktop.org, "Jerome Glisse" <jglisse@redhat.com>, kernel-janitors@vger.kernel.org, "Thomas
> Hellstrom" <thellstrom@vmware.com>, "Dan Carpenter" <dan.carpenter@oracle.com>
> Sent: Thursday, 8 December, 2011 4:53:34 PM
> Subject: Re: [patch] drm/ttm: fix condition (and vs or)
>
> On Thu, Dec 08, 2011 at 10:34:00AM -0500, Jerome Glisse wrote:
> > 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
>
> Duh!
> > > 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>
>
> And Acked-by me.
>
> Jerome, since you have the patches (And are thinking to send a GIT
> PULL
> to Dave) in your tree, could you include this patch in your queue?
>
I've taken the TTM changes into drm-next already, just reviewing the radeon stuff.
But if that appeared on top in Jerome's tree I can steal it.
Dave.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-12-08 16:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-08 6:50 [patch] drm/ttm: fix condition (and vs or) Dan Carpenter
2011-12-08 15:34 ` Jerome Glisse
2011-12-08 16:53 ` Konrad Rzeszutek Wilk
2011-12-08 16:58 ` David Airlie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox