aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/dmapool.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/dmapool.c')
-rw-r--r--drivers/base/dmapool.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c
index 33c5cce1560b..b2efbd4cf710 100644
--- a/drivers/base/dmapool.c
+++ b/drivers/base/dmapool.c
@@ -141,11 +141,20 @@ dma_pool_create (const char *name, struct device *dev,
141 init_waitqueue_head (&retval->waitq); 141 init_waitqueue_head (&retval->waitq);
142 142
143 if (dev) { 143 if (dev) {
144 int ret;
145
144 down (&pools_lock); 146 down (&pools_lock);
145 if (list_empty (&dev->dma_pools)) 147 if (list_empty (&dev->dma_pools))
146 device_create_file (dev, &dev_attr_pools); 148 ret = device_create_file (dev, &dev_attr_pools);
149 else
150 ret = 0;
147 /* note: not currently insisting "name" be unique */ 151 /* note: not currently insisting "name" be unique */
148 list_add (&retval->pools, &dev->dma_pools); 152 if (!ret)
153 list_add (&retval->pools, &dev->dma_pools);
154 else {
155 kfree(retval);
156 retval = NULL;
157 }
149 up (&pools_lock); 158 up (&pools_lock);
150 } else 159 } else
151 INIT_LIST_HEAD (&retval->pools); 160 INIT_LIST_HEAD (&retval->pools);