@@ -591,12 +591,12 @@ static struct dma_pool *ttm_dma_pool_init(struct device *dev, gfp_t flags,
pool = kmalloc_node(sizeof(struct dma_pool), GFP_KERNEL,
dev_to_node(dev));
if (!pool)
- goto err_mem;
+ goto free_devres;
sec_pool = kmalloc_node(sizeof(struct device_pools), GFP_KERNEL,
dev_to_node(dev));
if (!sec_pool)
- goto err_mem;
+ goto free_pool;
INIT_LIST_HEAD(&sec_pool->pools);
sec_pool->dev = dev;
@@ -637,10 +637,10 @@ static struct dma_pool *ttm_dma_pool_init(struct device *dev, gfp_t flags,
devres_add(dev, ptr);
return pool;
-err_mem:
- devres_free(ptr);
- kfree(sec_pool);
+ free_pool:
kfree(pool);
+ free_devres:
+ devres_free(ptr);
return ERR_PTR(-ENOMEM);
}