[11/12] driver core fixes: device_create_file() retval check in dmapool.c
- From: Cornelia Huck <cornelia.huck@xxxxxxxxxx>
- Date: Wed, 13 Sep 2006 18:39:04 +0200
From: Cornelia Huck <cornelia.huck@xxxxxxxxxx>
Check for device_create_file() return value in dma_pool_create().
Signed-off-by: Cornelia Huck <cornelia.huck@xxxxxxxxxx>
dmapool.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
--- linux-2.6.18-rc6/drivers/base/dmapool.c 2006-09-13 10:55:47.000000000 +0200
+++ linux-2.6.18-rc6+CH/drivers/base/dmapool.c 2006-09-13 10:55:03.000000000 +0200
@@ -141,11 +141,20 @@ dma_pool_create (const char *name, struc
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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Prev by Date: [05/12] driver core fixes: sysfs_create_link() retval check in class.c
- Next by Date: Re: [PATCH 4/6] Implement a general log2 facility in the kernel
- Previous by thread: [05/12] driver core fixes: sysfs_create_link() retval check in class.c
- Next by thread: [04/12] driver core fixes: retval check in class_register()
- Index(es):