Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 186644
b: refs/heads/master
c: 3bf040c
h: refs/heads/master
v: v3
  • Loading branch information
Minchan Kim authored and Greg Kroah-Hartman committed Mar 4, 2010
1 parent e2bd5d3 commit 7131dd8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b76a32638d9d7d6b421fccce02e667007509bd7b
refs/heads/master: 3bf040c75294ad9470b11902477e2c07af2031bd
21 changes: 13 additions & 8 deletions trunk/drivers/staging/ramzswap/ramzswap_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ static struct block_device_operations ramzswap_devops = {
.owner = THIS_MODULE,
};

static void create_device(struct ramzswap *rzs, int device_id)
static int create_device(struct ramzswap *rzs, int device_id)
{
mutex_init(&rzs->lock);
INIT_LIST_HEAD(&rzs->backing_swap_extent_list);
Expand All @@ -1301,7 +1301,7 @@ static void create_device(struct ramzswap *rzs, int device_id)
if (!rzs->queue) {
pr_err("Error allocating disk queue for device %d\n",
device_id);
return;
return 0;
}

blk_queue_make_request(rzs->queue, ramzswap_make_request);
Expand All @@ -1313,7 +1313,7 @@ static void create_device(struct ramzswap *rzs, int device_id)
blk_cleanup_queue(rzs->queue);
pr_warning("Error allocating disk structure for device %d\n",
device_id);
return;
return 0;
}

rzs->disk->major = ramzswap_major;
Expand All @@ -1331,6 +1331,7 @@ static void create_device(struct ramzswap *rzs, int device_id)
add_disk(rzs->disk);

rzs->init_done = 0;
return 1;
}

static void destroy_device(struct ramzswap *rzs)
Expand Down Expand Up @@ -1368,16 +1369,20 @@ static int __init ramzswap_init(void)
/* Allocate the device array and initialize each one */
pr_info("Creating %u devices ...\n", num_devices);
devices = kzalloc(num_devices * sizeof(struct ramzswap), GFP_KERNEL);
if (!devices) {
ret = -ENOMEM;
if (!devices)
goto out;
}

for (i = 0; i < num_devices; i++)
create_device(&devices[i], i);

if (!create_device(&devices[i], i)) {
ret = i;
goto free_devices;
}
return 0;
free_devices:
for (i = 0; i < ret; i++)
destroy_device(&devices[i]);
out:
ret = -ENOMEM;
unregister_blkdev(ramzswap_major, "ramzswap");
return ret;
}
Expand Down

0 comments on commit 7131dd8

Please sign in to comment.