summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2006-09-22 11:37:27 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2006-10-18 12:49:55 -0700
commit141ecc5320147d363d060cfc8042d197a3cdd496 (patch)
treecb1946b3bb46d075430ce10ddf518ee8ae91c772 /drivers/base
parenta306eea40952e6365301e8a2f7d5ffa9c6a1921b (diff)
downloadlinux-3.10-141ecc5320147d363d060cfc8042d197a3cdd496.tar.gz
linux-3.10-141ecc5320147d363d060cfc8042d197a3cdd496.tar.bz2
linux-3.10-141ecc5320147d363d060cfc8042d197a3cdd496.zip
driver core fixes: device_create_file() retval check in dmapool.c
Check for device_create_file() return value in dma_pool_create(). Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-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 33c5cce1560..b2efbd4cf71 100644
--- a/drivers/base/dmapool.c
+++ b/drivers/base/dmapool.c
@@ -141,11 +141,20 @@ dma_pool_create (const char *name, struct device *dev,
init_waitqueue_head (&retval->waitq);
if (dev) {
+ int ret;
+
down (&pools_lock);
if (list_empty (&dev->dma_pools))
- device_create_file (dev, &dev_attr_pools);
+ ret = device_create_file (dev, &dev_attr_pools);
+ else
+ ret = 0;
/* note: not currently insisting "name" be unique */
- list_add (&retval->pools, &dev->dma_pools);
+ if (!ret)
+ list_add (&retval->pools, &dev->dma_pools);
+ else {
+ kfree(retval);
+ retval = NULL;
+ }
up (&pools_lock);
} else
INIT_LIST_HEAD (&retval->pools);