Commit 6110d70b authored by Wei Yongjun's avatar Wei Yongjun Committed by Jens Axboe

drbd: fix error return code in drbd_init()

Fix to return a negative error code from the error handling
case instead of 0, as returned elsewhere in this function.
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: default avatarAndreas Gruenbacher <agruen@linbit.com>
Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 26ea8f92
...@@ -2762,8 +2762,6 @@ int __init drbd_init(void) ...@@ -2762,8 +2762,6 @@ int __init drbd_init(void)
/* /*
* allocate all necessary structs * allocate all necessary structs
*/ */
err = -ENOMEM;
init_waitqueue_head(&drbd_pp_wait); init_waitqueue_head(&drbd_pp_wait);
drbd_proc = NULL; /* play safe for drbd_cleanup */ drbd_proc = NULL; /* play safe for drbd_cleanup */
...@@ -2773,6 +2771,7 @@ int __init drbd_init(void) ...@@ -2773,6 +2771,7 @@ int __init drbd_init(void)
if (err) if (err)
goto fail; goto fail;
err = -ENOMEM;
drbd_proc = proc_create_data("drbd", S_IFREG | S_IRUGO , NULL, &drbd_proc_fops, NULL); drbd_proc = proc_create_data("drbd", S_IFREG | S_IRUGO , NULL, &drbd_proc_fops, NULL);
if (!drbd_proc) { if (!drbd_proc) {
printk(KERN_ERR "drbd: unable to register proc file\n"); printk(KERN_ERR "drbd: unable to register proc file\n");
...@@ -2803,7 +2802,6 @@ int __init drbd_init(void) ...@@ -2803,7 +2802,6 @@ int __init drbd_init(void)
fail: fail:
drbd_cleanup(); drbd_cleanup();
if (err == -ENOMEM) if (err == -ENOMEM)
/* currently always the case */
printk(KERN_ERR "drbd: ran out of memory\n"); printk(KERN_ERR "drbd: ran out of memory\n");
else else
printk(KERN_ERR "drbd: initialization failure\n"); printk(KERN_ERR "drbd: initialization failure\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment