diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2006-09-22 05:37:27 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-10-18 15:49:55 -0400 |
commit | 141ecc5320147d363d060cfc8042d197a3cdd496 (patch) | |
tree | cb1946b3bb46d075430ce10ddf518ee8ae91c772 | |
parent | a306eea40952e6365301e8a2f7d5ffa9c6a1921b (diff) |
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>
-rw-r--r-- | drivers/base/dmapool.c | 13 |
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); |