diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-10-04 06:34:03 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-10-04 14:26:25 -0400 |
commit | 83aabc1be551dd1f07266c125ff48ec62a2ce515 (patch) | |
tree | 6a9add23d4f6d04d86dc33002e2089499f6e83d6 /drivers/scsi/megaraid | |
parent | bb0766204c81d6bd01532476aec4e512c960fb4d (diff) |
[SCSI] SCSI megaraid_sas: handle thrown errors
- handle clear_user() error
- handle and properly unwind from sysfs errors thrown during mod init
- adjust order of calls in megasas_exit() to precisely match
registration order in megasas_init()
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Updated for extra attribute and
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/megaraid')
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.c | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index e21f638c00af..977b6e8d8525 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c | |||
@@ -2864,7 +2864,8 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg) | |||
2864 | int i; | 2864 | int i; |
2865 | int error = 0; | 2865 | int error = 0; |
2866 | 2866 | ||
2867 | clear_user(ioc, sizeof(*ioc)); | 2867 | if (clear_user(ioc, sizeof(*ioc))) |
2868 | return -EFAULT; | ||
2868 | 2869 | ||
2869 | if (copy_in_user(&ioc->host_no, &cioc->host_no, sizeof(u16)) || | 2870 | if (copy_in_user(&ioc->host_no, &cioc->host_no, sizeof(u16)) || |
2870 | copy_in_user(&ioc->sgl_off, &cioc->sgl_off, sizeof(u32)) || | 2871 | copy_in_user(&ioc->sgl_off, &cioc->sgl_off, sizeof(u32)) || |
@@ -3010,16 +3011,33 @@ static int __init megasas_init(void) | |||
3010 | 3011 | ||
3011 | if (rval) { | 3012 | if (rval) { |
3012 | printk(KERN_DEBUG "megasas: PCI hotplug regisration failed \n"); | 3013 | printk(KERN_DEBUG "megasas: PCI hotplug regisration failed \n"); |
3013 | unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); | 3014 | goto err_pcidrv; |
3014 | } | 3015 | } |
3015 | 3016 | ||
3016 | driver_create_file(&megasas_pci_driver.driver, &driver_attr_version); | 3017 | rval = driver_create_file(&megasas_pci_driver.driver, |
3017 | driver_create_file(&megasas_pci_driver.driver, | 3018 | &driver_attr_version); |
3018 | &driver_attr_release_date); | 3019 | if (rval) |
3019 | driver_create_file(&megasas_pci_driver.driver, | 3020 | goto err_dcf_attr_ver; |
3020 | &driver_attr_dbg_lvl); | 3021 | rval = driver_create_file(&megasas_pci_driver.driver, |
3022 | &driver_attr_release_date); | ||
3023 | if (rval) | ||
3024 | goto err_dcf_rel_date; | ||
3025 | rval = driver_create_file(&megasas_pci_driver.driver, | ||
3026 | &driver_attr_dbg_lvl); | ||
3027 | if (rval) | ||
3028 | goto err_dcf_dbg_lvl; | ||
3021 | 3029 | ||
3022 | return rval; | 3030 | return rval; |
3031 | err_dcf_dbg_lvl: | ||
3032 | driver_remove_file(&megasas_pci_driver.driver, | ||
3033 | &driver_attr_release_date); | ||
3034 | err_dcf_rel_date: | ||
3035 | driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version); | ||
3036 | err_dcf_attr_ver: | ||
3037 | pci_unregister_driver(&megasas_pci_driver); | ||
3038 | err_pcidrv: | ||
3039 | unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); | ||
3040 | return rval; | ||
3023 | } | 3041 | } |
3024 | 3042 | ||
3025 | /** | 3043 | /** |
@@ -3027,11 +3045,11 @@ static int __init megasas_init(void) | |||
3027 | */ | 3045 | */ |
3028 | static void __exit megasas_exit(void) | 3046 | static void __exit megasas_exit(void) |
3029 | { | 3047 | { |
3030 | driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version); | ||
3031 | driver_remove_file(&megasas_pci_driver.driver, | ||
3032 | &driver_attr_release_date); | ||
3033 | driver_remove_file(&megasas_pci_driver.driver, | 3048 | driver_remove_file(&megasas_pci_driver.driver, |
3034 | &driver_attr_dbg_lvl); | 3049 | &driver_attr_dbg_lvl); |
3050 | driver_remove_file(&megasas_pci_driver.driver, | ||
3051 | &driver_attr_release_date); | ||
3052 | driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version); | ||
3035 | 3053 | ||
3036 | pci_unregister_driver(&megasas_pci_driver); | 3054 | pci_unregister_driver(&megasas_pci_driver); |
3037 | unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); | 3055 | unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); |