From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Cc: ecashin@coraid.com
Subject: [PATCH] aoe: fix __init calling __exit
Date: Mon, 17 Jan 2005 13:45:00 -0800 [thread overview]
Message-ID: <1105998300627@kroah.com> (raw)
In-Reply-To: <11059983001178@kroah.com>
ChangeSet 1.2333, 2005/01/14 12:09:10-08:00, ecashin@coraid.com
[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: Ed L. Cashin <ecashin@coraid.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/block/aoe/aoechr.c | 2 +-
drivers/block/aoe/aoedev.c | 2 +-
drivers/block/aoe/aoemain.c | 44 +++++++++++++++++++++++++++++++-------------
drivers/block/aoe/aoenet.c | 2 +-
4 files changed, 34 insertions(+), 16 deletions(-)
diff -Nru a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
--- a/drivers/block/aoe/aoechr.c 2005-01-17 13:34:56 -08:00
+++ b/drivers/block/aoe/aoechr.c 2005-01-17 13:34:56 -08:00
@@ -266,7 +266,7 @@
return 0;
}
-void __exit
+void
aoechr_exit(void)
{
int i;
diff -Nru a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c
--- a/drivers/block/aoe/aoedev.c 2005-01-17 13:34:56 -08:00
+++ b/drivers/block/aoe/aoedev.c 2005-01-17 13:34:56 -08:00
@@ -151,7 +151,7 @@
kfree(d);
}
-void __exit
+void
aoedev_exit(void)
{
struct aoedev *d;
diff -Nru a/drivers/block/aoe/aoemain.c b/drivers/block/aoe/aoemain.c
--- a/drivers/block/aoe/aoemain.c 2005-01-17 13:34:56 -08:00
+++ b/drivers/block/aoe/aoemain.c 2005-01-17 13:34:56 -08:00
@@ -53,7 +53,7 @@
}
}
-static void __exit
+static void
aoe_exit(void)
{
discover_timer(TKILL);
@@ -68,25 +68,43 @@
static int __init
aoe_init(void)
{
- int n, (**p)(void);
- int (*fns[])(void) = {
- aoedev_init, aoechr_init, aoeblk_init, aoenet_init, NULL
- };
+ int ret;
- for (p=fns; *p != NULL; p++) {
- n = (*p)();
- if (n) {
- aoe_exit();
- printk(KERN_INFO "aoe: aoe_init: initialisation failure.\n");
- return n;
- }
+ ret = aoedev_init();
+ if (ret)
+ return ret;
+ ret = aoechr_init();
+ if (ret)
+ 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
"aoe: aoe_init: AoE v2.6-%s initialised.\n",
VERSION);
-
discover_timer(TINIT);
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);
diff -Nru a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c
--- a/drivers/block/aoe/aoenet.c 2005-01-17 13:34:56 -08:00
+++ b/drivers/block/aoe/aoenet.c 2005-01-17 13:34:56 -08:00
@@ -164,7 +164,7 @@
return 0;
}
-void __exit
+void
aoenet_exit(void)
{
dev_remove_pack(&aoe_pt);
prev parent reply other threads:[~2005-01-17 21:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-17 21:44 [BK PATCH] AOE and Block fixes for 2.6.11-rc1 Greg KH
2005-01-17 21:45 ` [PATCH] Block: Remove block_subsys.rwsem usage Greg KH
2005-01-17 21:45 ` [PATCH] Block: move struct disk_attribute to genhd.h Greg KH
2005-01-17 21:45 ` [PATCH] aoe: don't sleep with interrupts on Greg KH
2005-01-17 21:45 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1105998300627@kroah.com \
--to=greg@kroah.com \
--cc=ecashin@coraid.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.