diff options
author | Kei Tokunaga <tokunaga.keiich@jp.fujitsu.com> | 2010-03-15 01:48:43 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-04-11 10:23:45 -0400 |
commit | 65c054f235fda2d545ecd2a7948906a3cf0c1f39 (patch) | |
tree | b8782ce4208432df2336730a57dd427d620f2d1e /drivers/message/fusion/mptctl.c | |
parent | f018b73af6db4f330ad5da9ac53997a699c30c42 (diff) |
[SCSI] mpt: modify mptctl_exit() to call proper deregister functions
This patch fixes some issues of mptctl_exit().
1) It doesn't call mpt_deregister() for mptctl_taskmgmt_id
=> Insmoding/rmmoding mptctl.ko repeadtedly (up to
MPT_MAX_PROTOCOL_DRIVERS-1 at most) can eat up all cb_idx,
and that would cause a lack of MptCallbacks[], MptDriverClass[],
and MptEvHandlers[].
2) It doesn't call mpt_event_deregister() for mptctl_id
=> Need to call it.
3) It calls mpt_reset_deregister() for mptctl_taskmgmt_id
=> This could accidentally deregister an innocent reset handler
that you don't want to.
This patch also adds a check for mptctl_taskmgmt_id.
Signed-off-by: Kei Tokunaga <tokunaga.keiich@jp.fujitsu.com>
Acked-by: "Desai, Kashyap" <Kashyap.Desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/message/fusion/mptctl.c')
-rw-r--r-- | drivers/message/fusion/mptctl.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index caa8f568a41c..80421d2cf049 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c | |||
@@ -2991,6 +2991,14 @@ static int __init mptctl_init(void) | |||
2991 | } | 2991 | } |
2992 | 2992 | ||
2993 | mptctl_taskmgmt_id = mpt_register(mptctl_taskmgmt_reply, MPTCTL_DRIVER); | 2993 | mptctl_taskmgmt_id = mpt_register(mptctl_taskmgmt_reply, MPTCTL_DRIVER); |
2994 | if (!mptctl_taskmgmt_id || mptctl_taskmgmt_id >= MPT_MAX_PROTOCOL_DRIVERS) { | ||
2995 | printk(KERN_ERR MYNAM ": ERROR: Failed to register with Fusion MPT base driver\n"); | ||
2996 | mpt_deregister(mptctl_id); | ||
2997 | misc_deregister(&mptctl_miscdev); | ||
2998 | err = -EBUSY; | ||
2999 | goto out_fail; | ||
3000 | } | ||
3001 | |||
2994 | mpt_reset_register(mptctl_id, mptctl_ioc_reset); | 3002 | mpt_reset_register(mptctl_id, mptctl_ioc_reset); |
2995 | mpt_event_register(mptctl_id, mptctl_event_process); | 3003 | mpt_event_register(mptctl_id, mptctl_event_process); |
2996 | 3004 | ||
@@ -3010,12 +3018,15 @@ static void mptctl_exit(void) | |||
3010 | printk(KERN_INFO MYNAM ": Deregistered /dev/%s @ (major,minor=%d,%d)\n", | 3018 | printk(KERN_INFO MYNAM ": Deregistered /dev/%s @ (major,minor=%d,%d)\n", |
3011 | mptctl_miscdev.name, MISC_MAJOR, mptctl_miscdev.minor); | 3019 | mptctl_miscdev.name, MISC_MAJOR, mptctl_miscdev.minor); |
3012 | 3020 | ||
3021 | /* De-register event handler from base module */ | ||
3022 | mpt_event_deregister(mptctl_id); | ||
3023 | |||
3013 | /* De-register reset handler from base module */ | 3024 | /* De-register reset handler from base module */ |
3014 | mpt_reset_deregister(mptctl_id); | 3025 | mpt_reset_deregister(mptctl_id); |
3015 | 3026 | ||
3016 | /* De-register callback handler from base module */ | 3027 | /* De-register callback handler from base module */ |
3028 | mpt_deregister(mptctl_taskmgmt_id); | ||
3017 | mpt_deregister(mptctl_id); | 3029 | mpt_deregister(mptctl_id); |
3018 | mpt_reset_deregister(mptctl_taskmgmt_id); | ||
3019 | 3030 | ||
3020 | mpt_device_driver_deregister(MPTCTL_DRIVER); | 3031 | mpt_device_driver_deregister(MPTCTL_DRIVER); |
3021 | 3032 | ||