[PATCH 07/12] drm/ttm: Simplify ttm_dma_find_pool()

Tom St Denis tom.stdenis at amd.com
Fri Jan 26 18:29:06 UTC 2018


Signed-off-by: Tom St Denis <tom.stdenis at amd.com>
---
 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
index 962838cfb1a3..579c4aedc17e 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
@@ -680,10 +680,10 @@ static struct dma_pool *ttm_dma_pool_init(struct device *dev, gfp_t flags,
 static struct dma_pool *ttm_dma_find_pool(struct device *dev,
 					  enum pool_type type)
 {
-	struct dma_pool *pool, *tmp, *found = NULL;
+	struct dma_pool *pool, *tmp;
 
 	if (type == IS_UNDEFINED)
-		return found;
+		return NULL;
 
 	/* NB: We iterate on the 'struct dev' which has no spinlock, but
 	 * it does have a kref which we have taken. The kref is taken during
@@ -697,12 +697,10 @@ static struct dma_pool *ttm_dma_find_pool(struct device *dev,
 	 * driver so this function will not be called.
 	 */
 	list_for_each_entry_safe(pool, tmp, &dev->dma_pools, pools) {
-		if (pool->type != type)
-			continue;
-		found = pool;
-		break;
+		if (pool->type == type)
+			return pool;
 	}
-	return found;
+	return NULL;
 }
 
 /*
-- 
2.14.3



More information about the amd-gfx mailing list