Commit 8b73df12 authored by Ed L. Cashin's avatar Ed L. Cashin Committed by Greg Kroah-Hartman

[PATCH] aoe: fix __init calling __exit

Russell King <rmk+lkml@arm.linux.org.uk> writes:

> static void __exit
> aoe_exit(void)
> {
> ...
> }
>
> static int __init
> aoe_init(void)
> {
> ...
>                         aoe_exit();
> ...
> }

Thanks for catching that.  I cleaned up the error handling, too.

Don't call __exit functions from __init functions.
Signed-off-by: default avatarEd L. Cashin <ecashin@coraid.com>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 122765b7
...@@ -266,7 +266,7 @@ aoechr_init(void) ...@@ -266,7 +266,7 @@ aoechr_init(void)
return 0; return 0;
} }
void __exit void
aoechr_exit(void) aoechr_exit(void)
{ {
int i; int i;
......
...@@ -151,7 +151,7 @@ aoedev_freedev(struct aoedev *d) ...@@ -151,7 +151,7 @@ aoedev_freedev(struct aoedev *d)
kfree(d); kfree(d);
} }
void __exit void
aoedev_exit(void) aoedev_exit(void)
{ {
struct aoedev *d; struct aoedev *d;
......
...@@ -53,7 +53,7 @@ discover_timer(ulong vp) ...@@ -53,7 +53,7 @@ discover_timer(ulong vp)
} }
} }
static void __exit static void
aoe_exit(void) aoe_exit(void)
{ {
discover_timer(TKILL); discover_timer(TKILL);
...@@ -68,25 +68,43 @@ aoe_exit(void) ...@@ -68,25 +68,43 @@ aoe_exit(void)
static int __init static int __init
aoe_init(void) aoe_init(void)
{ {
int n, (**p)(void); int ret;
int (*fns[])(void) = {
aoedev_init, aoechr_init, aoeblk_init, aoenet_init, NULL
};
for (p=fns; *p != NULL; p++) { ret = aoedev_init();
n = (*p)(); if (ret)
if (n) { return ret;
aoe_exit(); ret = aoechr_init();
printk(KERN_INFO "aoe: aoe_init: initialisation failure.\n"); if (ret)
return n; goto chr_fail;
} ret = aoeblk_init();
if (ret)
goto blk_fail;
ret = aoenet_init();
if (ret)
goto net_fail;
ret = register_blkdev(AOE_MAJOR, DEVICE_NAME);
if (ret < 0) {
printk(KERN_ERR "aoe: aoeblk_init: can't register major\n");
goto blkreg_fail;
} }
printk(KERN_INFO printk(KERN_INFO
"aoe: aoe_init: AoE v2.6-%s initialised.\n", "aoe: aoe_init: AoE v2.6-%s initialised.\n",
VERSION); VERSION);
discover_timer(TINIT); discover_timer(TINIT);
return 0; return 0;
blkreg_fail:
aoenet_exit();
net_fail:
aoeblk_exit();
blk_fail:
aoechr_exit();
chr_fail:
aoedev_exit();
printk(KERN_INFO "aoe: aoe_init: initialisation failure.\n");
return ret;
} }
module_init(aoe_init); module_init(aoe_init);
......
...@@ -164,7 +164,7 @@ aoenet_init(void) ...@@ -164,7 +164,7 @@ aoenet_init(void)
return 0; return 0;
} }
void __exit void
aoenet_exit(void) aoenet_exit(void)
{ {
dev_remove_pack(&aoe_pt); dev_remove_pack(&aoe_pt);
......
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