diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/bfa/bfad_fwimg.c | 2 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_im.c | 2 | ||||
-rw-r--r-- | drivers/scsi/gdth.c | 2 | ||||
-rw-r--r-- | drivers/scsi/hosts.c | 2 | ||||
-rw-r--r-- | drivers/scsi/ipr.c | 42 | ||||
-rw-r--r-- | drivers/scsi/ipr.h | 1 | ||||
-rw-r--r-- | drivers/scsi/libsas/sas_expander.c | 1 | ||||
-rw-r--r-- | drivers/scsi/pmcraid.c | 10 | ||||
-rw-r--r-- | drivers/scsi/scsi_scan.c | 18 | ||||
-rw-r--r-- | drivers/scsi/scsi_sysfs.c | 63 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_fc.c | 3 | ||||
-rw-r--r-- | drivers/scsi/sd_dif.c | 2 |
12 files changed, 79 insertions, 69 deletions
diff --git a/drivers/scsi/bfa/bfad_fwimg.c b/drivers/scsi/bfa/bfad_fwimg.c index b2f6949bc8d3..bd34b0db2d6b 100644 --- a/drivers/scsi/bfa/bfad_fwimg.c +++ b/drivers/scsi/bfa/bfad_fwimg.c | |||
@@ -41,6 +41,8 @@ u32 *bfi_image_cb; | |||
41 | 41 | ||
42 | #define BFAD_FW_FILE_CT "ctfw.bin" | 42 | #define BFAD_FW_FILE_CT "ctfw.bin" |
43 | #define BFAD_FW_FILE_CB "cbfw.bin" | 43 | #define BFAD_FW_FILE_CB "cbfw.bin" |
44 | MODULE_FIRMWARE(BFAD_FW_FILE_CT); | ||
45 | MODULE_FIRMWARE(BFAD_FW_FILE_CB); | ||
44 | 46 | ||
45 | u32 * | 47 | u32 * |
46 | bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image, | 48 | bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image, |
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index 158c99243c08..55d012a9a668 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c | |||
@@ -948,7 +948,7 @@ bfad_os_fc_host_init(struct bfad_im_port_s *im_port) | |||
948 | if (bfad_supported_fc4s & (BFA_PORT_ROLE_FCP_IM | BFA_PORT_ROLE_FCP_TM)) | 948 | if (bfad_supported_fc4s & (BFA_PORT_ROLE_FCP_IM | BFA_PORT_ROLE_FCP_TM)) |
949 | /* For FCP type 0x08 */ | 949 | /* For FCP type 0x08 */ |
950 | fc_host_supported_fc4s(host)[2] = 1; | 950 | fc_host_supported_fc4s(host)[2] = 1; |
951 | if (bfad_supported_fc4s | BFA_PORT_ROLE_FCP_IPFC) | 951 | if (bfad_supported_fc4s & BFA_PORT_ROLE_FCP_IPFC) |
952 | /* For LLC/SNAP type 0x05 */ | 952 | /* For LLC/SNAP type 0x05 */ |
953 | fc_host_supported_fc4s(host)[3] = 0x20; | 953 | fc_host_supported_fc4s(host)[3] = 0x20; |
954 | /* For fibre channel services type 0x20 */ | 954 | /* For fibre channel services type 0x20 */ |
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 185e6bc4dd40..9e8fce0f0c1b 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -2900,7 +2900,7 @@ static int gdth_read_event(gdth_ha_str *ha, int handle, gdth_evt_str *estr) | |||
2900 | eindex = handle; | 2900 | eindex = handle; |
2901 | estr->event_source = 0; | 2901 | estr->event_source = 0; |
2902 | 2902 | ||
2903 | if (eindex >= MAX_EVENTS) { | 2903 | if (eindex < 0 || eindex >= MAX_EVENTS) { |
2904 | spin_unlock_irqrestore(&ha->smp_lock, flags); | 2904 | spin_unlock_irqrestore(&ha->smp_lock, flags); |
2905 | return eindex; | 2905 | return eindex; |
2906 | } | 2906 | } |
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 5fd2da494d08..c968cc31cd86 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
@@ -164,8 +164,8 @@ void scsi_remove_host(struct Scsi_Host *shost) | |||
164 | return; | 164 | return; |
165 | } | 165 | } |
166 | spin_unlock_irqrestore(shost->host_lock, flags); | 166 | spin_unlock_irqrestore(shost->host_lock, flags); |
167 | mutex_unlock(&shost->scan_mutex); | ||
168 | scsi_forget_host(shost); | 167 | scsi_forget_host(shost); |
168 | mutex_unlock(&shost->scan_mutex); | ||
169 | scsi_proc_host_rm(shost); | 169 | scsi_proc_host_rm(shost); |
170 | 170 | ||
171 | spin_lock_irqsave(shost->host_lock, flags); | 171 | spin_lock_irqsave(shost->host_lock, flags); |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 5f045505a1f4..76d294fc7846 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -4189,6 +4189,25 @@ static irqreturn_t ipr_handle_other_interrupt(struct ipr_ioa_cfg *ioa_cfg, | |||
4189 | } | 4189 | } |
4190 | 4190 | ||
4191 | /** | 4191 | /** |
4192 | * ipr_isr_eh - Interrupt service routine error handler | ||
4193 | * @ioa_cfg: ioa config struct | ||
4194 | * @msg: message to log | ||
4195 | * | ||
4196 | * Return value: | ||
4197 | * none | ||
4198 | **/ | ||
4199 | static void ipr_isr_eh(struct ipr_ioa_cfg *ioa_cfg, char *msg) | ||
4200 | { | ||
4201 | ioa_cfg->errors_logged++; | ||
4202 | dev_err(&ioa_cfg->pdev->dev, "%s\n", msg); | ||
4203 | |||
4204 | if (WAIT_FOR_DUMP == ioa_cfg->sdt_state) | ||
4205 | ioa_cfg->sdt_state = GET_DUMP; | ||
4206 | |||
4207 | ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE); | ||
4208 | } | ||
4209 | |||
4210 | /** | ||
4192 | * ipr_isr - Interrupt service routine | 4211 | * ipr_isr - Interrupt service routine |
4193 | * @irq: irq number | 4212 | * @irq: irq number |
4194 | * @devp: pointer to ioa config struct | 4213 | * @devp: pointer to ioa config struct |
@@ -4203,6 +4222,7 @@ static irqreturn_t ipr_isr(int irq, void *devp) | |||
4203 | volatile u32 int_reg, int_mask_reg; | 4222 | volatile u32 int_reg, int_mask_reg; |
4204 | u32 ioasc; | 4223 | u32 ioasc; |
4205 | u16 cmd_index; | 4224 | u16 cmd_index; |
4225 | int num_hrrq = 0; | ||
4206 | struct ipr_cmnd *ipr_cmd; | 4226 | struct ipr_cmnd *ipr_cmd; |
4207 | irqreturn_t rc = IRQ_NONE; | 4227 | irqreturn_t rc = IRQ_NONE; |
4208 | 4228 | ||
@@ -4233,13 +4253,7 @@ static irqreturn_t ipr_isr(int irq, void *devp) | |||
4233 | IPR_HRRQ_REQ_RESP_HANDLE_MASK) >> IPR_HRRQ_REQ_RESP_HANDLE_SHIFT; | 4253 | IPR_HRRQ_REQ_RESP_HANDLE_MASK) >> IPR_HRRQ_REQ_RESP_HANDLE_SHIFT; |
4234 | 4254 | ||
4235 | if (unlikely(cmd_index >= IPR_NUM_CMD_BLKS)) { | 4255 | if (unlikely(cmd_index >= IPR_NUM_CMD_BLKS)) { |
4236 | ioa_cfg->errors_logged++; | 4256 | ipr_isr_eh(ioa_cfg, "Invalid response handle from IOA"); |
4237 | dev_err(&ioa_cfg->pdev->dev, "Invalid response handle from IOA\n"); | ||
4238 | |||
4239 | if (WAIT_FOR_DUMP == ioa_cfg->sdt_state) | ||
4240 | ioa_cfg->sdt_state = GET_DUMP; | ||
4241 | |||
4242 | ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE); | ||
4243 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | 4257 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
4244 | return IRQ_HANDLED; | 4258 | return IRQ_HANDLED; |
4245 | } | 4259 | } |
@@ -4266,8 +4280,18 @@ static irqreturn_t ipr_isr(int irq, void *devp) | |||
4266 | 4280 | ||
4267 | if (ipr_cmd != NULL) { | 4281 | if (ipr_cmd != NULL) { |
4268 | /* Clear the PCI interrupt */ | 4282 | /* Clear the PCI interrupt */ |
4269 | writel(IPR_PCII_HRRQ_UPDATED, ioa_cfg->regs.clr_interrupt_reg); | 4283 | do { |
4270 | int_reg = readl(ioa_cfg->regs.sense_interrupt_reg) & ~int_mask_reg; | 4284 | writel(IPR_PCII_HRRQ_UPDATED, ioa_cfg->regs.clr_interrupt_reg); |
4285 | int_reg = readl(ioa_cfg->regs.sense_interrupt_reg) & ~int_mask_reg; | ||
4286 | } while (int_reg & IPR_PCII_HRRQ_UPDATED && | ||
4287 | num_hrrq++ < IPR_MAX_HRRQ_RETRIES); | ||
4288 | |||
4289 | if (int_reg & IPR_PCII_HRRQ_UPDATED) { | ||
4290 | ipr_isr_eh(ioa_cfg, "Error clearing HRRQ"); | ||
4291 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | ||
4292 | return IRQ_HANDLED; | ||
4293 | } | ||
4294 | |||
4271 | } else | 4295 | } else |
4272 | break; | 4296 | break; |
4273 | } | 4297 | } |
diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h index 163245a1c3e5..19bbcf39f0c9 100644 --- a/drivers/scsi/ipr.h +++ b/drivers/scsi/ipr.h | |||
@@ -144,6 +144,7 @@ | |||
144 | #define IPR_IOA_MAX_SECTORS 32767 | 144 | #define IPR_IOA_MAX_SECTORS 32767 |
145 | #define IPR_VSET_MAX_SECTORS 512 | 145 | #define IPR_VSET_MAX_SECTORS 512 |
146 | #define IPR_MAX_CDB_LEN 16 | 146 | #define IPR_MAX_CDB_LEN 16 |
147 | #define IPR_MAX_HRRQ_RETRIES 3 | ||
147 | 148 | ||
148 | #define IPR_DEFAULT_BUS_WIDTH 16 | 149 | #define IPR_DEFAULT_BUS_WIDTH 16 |
149 | #define IPR_80MBs_SCSI_RATE ((80 * 10) / (IPR_DEFAULT_BUS_WIDTH / 8)) | 150 | #define IPR_80MBs_SCSI_RATE ((80 * 10) / (IPR_DEFAULT_BUS_WIDTH / 8)) |
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index b3381959acce..33cf988c8c8a 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -960,7 +960,6 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id) | |||
960 | 960 | ||
961 | } | 961 | } |
962 | } | 962 | } |
963 | res = 0; | ||
964 | } | 963 | } |
965 | 964 | ||
966 | return res; | 965 | return res; |
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index f7c70e2a8224..0a97bc9074bb 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c | |||
@@ -1071,7 +1071,7 @@ static struct pmcraid_cmd *pmcraid_init_hcam | |||
1071 | 1071 | ||
1072 | ioarcb->data_transfer_length = cpu_to_le32(rcb_size); | 1072 | ioarcb->data_transfer_length = cpu_to_le32(rcb_size); |
1073 | 1073 | ||
1074 | ioadl[0].flags |= cpu_to_le32(IOADL_FLAGS_READ_LAST); | 1074 | ioadl[0].flags |= IOADL_FLAGS_READ_LAST; |
1075 | ioadl[0].data_len = cpu_to_le32(rcb_size); | 1075 | ioadl[0].data_len = cpu_to_le32(rcb_size); |
1076 | ioadl[0].address = cpu_to_le32(dma); | 1076 | ioadl[0].address = cpu_to_le32(dma); |
1077 | 1077 | ||
@@ -2251,7 +2251,7 @@ static void pmcraid_request_sense(struct pmcraid_cmd *cmd) | |||
2251 | 2251 | ||
2252 | ioadl->address = cpu_to_le64(cmd->sense_buffer_dma); | 2252 | ioadl->address = cpu_to_le64(cmd->sense_buffer_dma); |
2253 | ioadl->data_len = cpu_to_le32(SCSI_SENSE_BUFFERSIZE); | 2253 | ioadl->data_len = cpu_to_le32(SCSI_SENSE_BUFFERSIZE); |
2254 | ioadl->flags = cpu_to_le32(IOADL_FLAGS_LAST_DESC); | 2254 | ioadl->flags = IOADL_FLAGS_LAST_DESC; |
2255 | 2255 | ||
2256 | /* request sense might be called as part of error response processing | 2256 | /* request sense might be called as part of error response processing |
2257 | * which runs in tasklets context. It is possible that mid-layer might | 2257 | * which runs in tasklets context. It is possible that mid-layer might |
@@ -3017,7 +3017,7 @@ static int pmcraid_build_ioadl( | |||
3017 | ioadl[i].flags = 0; | 3017 | ioadl[i].flags = 0; |
3018 | } | 3018 | } |
3019 | /* setup last descriptor */ | 3019 | /* setup last descriptor */ |
3020 | ioadl[i - 1].flags = cpu_to_le32(IOADL_FLAGS_LAST_DESC); | 3020 | ioadl[i - 1].flags = IOADL_FLAGS_LAST_DESC; |
3021 | 3021 | ||
3022 | return 0; | 3022 | return 0; |
3023 | } | 3023 | } |
@@ -3387,7 +3387,7 @@ static int pmcraid_build_passthrough_ioadls( | |||
3387 | } | 3387 | } |
3388 | 3388 | ||
3389 | /* setup the last descriptor */ | 3389 | /* setup the last descriptor */ |
3390 | ioadl[i - 1].flags = cpu_to_le32(IOADL_FLAGS_LAST_DESC); | 3390 | ioadl[i - 1].flags = IOADL_FLAGS_LAST_DESC; |
3391 | 3391 | ||
3392 | return 0; | 3392 | return 0; |
3393 | } | 3393 | } |
@@ -5314,7 +5314,7 @@ static void pmcraid_querycfg(struct pmcraid_cmd *cmd) | |||
5314 | cpu_to_le32(sizeof(struct pmcraid_config_table)); | 5314 | cpu_to_le32(sizeof(struct pmcraid_config_table)); |
5315 | 5315 | ||
5316 | ioadl = &(ioarcb->add_data.u.ioadl[0]); | 5316 | ioadl = &(ioarcb->add_data.u.ioadl[0]); |
5317 | ioadl->flags = cpu_to_le32(IOADL_FLAGS_LAST_DESC); | 5317 | ioadl->flags = IOADL_FLAGS_LAST_DESC; |
5318 | ioadl->address = cpu_to_le64(pinstance->cfg_table_bus_addr); | 5318 | ioadl->address = cpu_to_le64(pinstance->cfg_table_bus_addr); |
5319 | ioadl->data_len = cpu_to_le32(sizeof(struct pmcraid_config_table)); | 5319 | ioadl->data_len = cpu_to_le32(sizeof(struct pmcraid_config_table)); |
5320 | 5320 | ||
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 0547a7f44d42..47291bcff0d5 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -952,16 +952,6 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result, | |||
952 | return SCSI_SCAN_LUN_PRESENT; | 952 | return SCSI_SCAN_LUN_PRESENT; |
953 | } | 953 | } |
954 | 954 | ||
955 | static inline void scsi_destroy_sdev(struct scsi_device *sdev) | ||
956 | { | ||
957 | scsi_device_set_state(sdev, SDEV_DEL); | ||
958 | if (sdev->host->hostt->slave_destroy) | ||
959 | sdev->host->hostt->slave_destroy(sdev); | ||
960 | transport_destroy_device(&sdev->sdev_gendev); | ||
961 | put_device(&sdev->sdev_dev); | ||
962 | put_device(&sdev->sdev_gendev); | ||
963 | } | ||
964 | |||
965 | #ifdef CONFIG_SCSI_LOGGING | 955 | #ifdef CONFIG_SCSI_LOGGING |
966 | /** | 956 | /** |
967 | * scsi_inq_str - print INQUIRY data from min to max index, strip trailing whitespace | 957 | * scsi_inq_str - print INQUIRY data from min to max index, strip trailing whitespace |
@@ -1139,7 +1129,7 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget, | |||
1139 | } | 1129 | } |
1140 | } | 1130 | } |
1141 | } else | 1131 | } else |
1142 | scsi_destroy_sdev(sdev); | 1132 | __scsi_remove_device(sdev); |
1143 | out: | 1133 | out: |
1144 | return res; | 1134 | return res; |
1145 | } | 1135 | } |
@@ -1500,7 +1490,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, | |||
1500 | /* | 1490 | /* |
1501 | * the sdev we used didn't appear in the report luns scan | 1491 | * the sdev we used didn't appear in the report luns scan |
1502 | */ | 1492 | */ |
1503 | scsi_destroy_sdev(sdev); | 1493 | __scsi_remove_device(sdev); |
1504 | return ret; | 1494 | return ret; |
1505 | } | 1495 | } |
1506 | 1496 | ||
@@ -1710,7 +1700,7 @@ static void scsi_sysfs_add_devices(struct Scsi_Host *shost) | |||
1710 | shost_for_each_device(sdev, shost) { | 1700 | shost_for_each_device(sdev, shost) { |
1711 | if (!scsi_host_scan_allowed(shost) || | 1701 | if (!scsi_host_scan_allowed(shost) || |
1712 | scsi_sysfs_add_sdev(sdev) != 0) | 1702 | scsi_sysfs_add_sdev(sdev) != 0) |
1713 | scsi_destroy_sdev(sdev); | 1703 | __scsi_remove_device(sdev); |
1714 | } | 1704 | } |
1715 | } | 1705 | } |
1716 | 1706 | ||
@@ -1943,7 +1933,7 @@ void scsi_free_host_dev(struct scsi_device *sdev) | |||
1943 | { | 1933 | { |
1944 | BUG_ON(sdev->id != sdev->host->this_id); | 1934 | BUG_ON(sdev->id != sdev->host->this_id); |
1945 | 1935 | ||
1946 | scsi_destroy_sdev(sdev); | 1936 | __scsi_remove_device(sdev); |
1947 | } | 1937 | } |
1948 | EXPORT_SYMBOL(scsi_free_host_dev); | 1938 | EXPORT_SYMBOL(scsi_free_host_dev); |
1949 | 1939 | ||
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 5c7eb63a19d1..392d8db33905 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -854,82 +854,73 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) | |||
854 | transport_configure_device(&starget->dev); | 854 | transport_configure_device(&starget->dev); |
855 | error = device_add(&sdev->sdev_gendev); | 855 | error = device_add(&sdev->sdev_gendev); |
856 | if (error) { | 856 | if (error) { |
857 | put_device(sdev->sdev_gendev.parent); | ||
858 | printk(KERN_INFO "error 1\n"); | 857 | printk(KERN_INFO "error 1\n"); |
859 | return error; | 858 | goto out_remove; |
860 | } | 859 | } |
861 | error = device_add(&sdev->sdev_dev); | 860 | error = device_add(&sdev->sdev_dev); |
862 | if (error) { | 861 | if (error) { |
863 | printk(KERN_INFO "error 2\n"); | 862 | printk(KERN_INFO "error 2\n"); |
864 | goto clean_device; | 863 | device_del(&sdev->sdev_gendev); |
864 | goto out_remove; | ||
865 | } | 865 | } |
866 | transport_add_device(&sdev->sdev_gendev); | ||
867 | sdev->is_visible = 1; | ||
866 | 868 | ||
867 | /* create queue files, which may be writable, depending on the host */ | 869 | /* create queue files, which may be writable, depending on the host */ |
868 | if (sdev->host->hostt->change_queue_depth) | 870 | if (sdev->host->hostt->change_queue_depth) |
869 | error = device_create_file(&sdev->sdev_gendev, &sdev_attr_queue_depth_rw); | 871 | error = device_create_file(&sdev->sdev_gendev, &sdev_attr_queue_depth_rw); |
870 | else | 872 | else |
871 | error = device_create_file(&sdev->sdev_gendev, &dev_attr_queue_depth); | 873 | error = device_create_file(&sdev->sdev_gendev, &dev_attr_queue_depth); |
872 | if (error) { | 874 | if (error) |
873 | __scsi_remove_device(sdev); | 875 | goto out_remove; |
874 | goto out; | 876 | |
875 | } | ||
876 | if (sdev->host->hostt->change_queue_type) | 877 | if (sdev->host->hostt->change_queue_type) |
877 | error = device_create_file(&sdev->sdev_gendev, &sdev_attr_queue_type_rw); | 878 | error = device_create_file(&sdev->sdev_gendev, &sdev_attr_queue_type_rw); |
878 | else | 879 | else |
879 | error = device_create_file(&sdev->sdev_gendev, &dev_attr_queue_type); | 880 | error = device_create_file(&sdev->sdev_gendev, &dev_attr_queue_type); |
880 | if (error) { | 881 | if (error) |
881 | __scsi_remove_device(sdev); | 882 | goto out_remove; |
882 | goto out; | ||
883 | } | ||
884 | 883 | ||
885 | error = bsg_register_queue(rq, &sdev->sdev_gendev, NULL, NULL); | 884 | error = bsg_register_queue(rq, &sdev->sdev_gendev, NULL, NULL); |
886 | 885 | ||
887 | if (error) | 886 | if (error) |
887 | /* we're treating error on bsg register as non-fatal, | ||
888 | * so pretend nothing went wrong */ | ||
888 | sdev_printk(KERN_INFO, sdev, | 889 | sdev_printk(KERN_INFO, sdev, |
889 | "Failed to register bsg queue, errno=%d\n", error); | 890 | "Failed to register bsg queue, errno=%d\n", error); |
890 | 891 | ||
891 | /* we're treating error on bsg register as non-fatal, so pretend | ||
892 | * nothing went wrong */ | ||
893 | error = 0; | ||
894 | |||
895 | /* add additional host specific attributes */ | 892 | /* add additional host specific attributes */ |
896 | if (sdev->host->hostt->sdev_attrs) { | 893 | if (sdev->host->hostt->sdev_attrs) { |
897 | for (i = 0; sdev->host->hostt->sdev_attrs[i]; i++) { | 894 | for (i = 0; sdev->host->hostt->sdev_attrs[i]; i++) { |
898 | error = device_create_file(&sdev->sdev_gendev, | 895 | error = device_create_file(&sdev->sdev_gendev, |
899 | sdev->host->hostt->sdev_attrs[i]); | 896 | sdev->host->hostt->sdev_attrs[i]); |
900 | if (error) { | 897 | if (error) |
901 | __scsi_remove_device(sdev); | 898 | goto out_remove; |
902 | goto out; | ||
903 | } | ||
904 | } | 899 | } |
905 | } | 900 | } |
906 | 901 | ||
907 | transport_add_device(&sdev->sdev_gendev); | 902 | return 0; |
908 | out: | ||
909 | return error; | ||
910 | |||
911 | clean_device: | ||
912 | scsi_device_set_state(sdev, SDEV_CANCEL); | ||
913 | |||
914 | device_del(&sdev->sdev_gendev); | ||
915 | transport_destroy_device(&sdev->sdev_gendev); | ||
916 | put_device(&sdev->sdev_dev); | ||
917 | put_device(&sdev->sdev_gendev); | ||
918 | 903 | ||
904 | out_remove: | ||
905 | __scsi_remove_device(sdev); | ||
919 | return error; | 906 | return error; |
907 | |||
920 | } | 908 | } |
921 | 909 | ||
922 | void __scsi_remove_device(struct scsi_device *sdev) | 910 | void __scsi_remove_device(struct scsi_device *sdev) |
923 | { | 911 | { |
924 | struct device *dev = &sdev->sdev_gendev; | 912 | struct device *dev = &sdev->sdev_gendev; |
925 | 913 | ||
926 | if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0) | 914 | if (sdev->is_visible) { |
927 | return; | 915 | if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0) |
916 | return; | ||
928 | 917 | ||
929 | bsg_unregister_queue(sdev->request_queue); | 918 | bsg_unregister_queue(sdev->request_queue); |
930 | device_unregister(&sdev->sdev_dev); | 919 | device_unregister(&sdev->sdev_dev); |
931 | transport_remove_device(dev); | 920 | transport_remove_device(dev); |
932 | device_del(dev); | 921 | device_del(dev); |
922 | } else | ||
923 | put_device(&sdev->sdev_dev); | ||
933 | scsi_device_set_state(sdev, SDEV_DEL); | 924 | scsi_device_set_state(sdev, SDEV_DEL); |
934 | if (sdev->host->hostt->slave_destroy) | 925 | if (sdev->host->hostt->slave_destroy) |
935 | sdev->host->hostt->slave_destroy(sdev); | 926 | sdev->host->hostt->slave_destroy(sdev); |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index a67fed10598a..c6f70dae9b2e 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -3656,6 +3656,7 @@ fc_bsg_host_dispatch(struct request_queue *q, struct Scsi_Host *shost, | |||
3656 | fail_host_msg: | 3656 | fail_host_msg: |
3657 | /* return the errno failure code as the only status */ | 3657 | /* return the errno failure code as the only status */ |
3658 | BUG_ON(job->reply_len < sizeof(uint32_t)); | 3658 | BUG_ON(job->reply_len < sizeof(uint32_t)); |
3659 | job->reply->reply_payload_rcv_len = 0; | ||
3659 | job->reply->result = ret; | 3660 | job->reply->result = ret; |
3660 | job->reply_len = sizeof(uint32_t); | 3661 | job->reply_len = sizeof(uint32_t); |
3661 | fc_bsg_jobdone(job); | 3662 | fc_bsg_jobdone(job); |
@@ -3741,6 +3742,7 @@ check_bidi: | |||
3741 | fail_rport_msg: | 3742 | fail_rport_msg: |
3742 | /* return the errno failure code as the only status */ | 3743 | /* return the errno failure code as the only status */ |
3743 | BUG_ON(job->reply_len < sizeof(uint32_t)); | 3744 | BUG_ON(job->reply_len < sizeof(uint32_t)); |
3745 | job->reply->reply_payload_rcv_len = 0; | ||
3744 | job->reply->result = ret; | 3746 | job->reply->result = ret; |
3745 | job->reply_len = sizeof(uint32_t); | 3747 | job->reply_len = sizeof(uint32_t); |
3746 | fc_bsg_jobdone(job); | 3748 | fc_bsg_jobdone(job); |
@@ -3797,6 +3799,7 @@ fc_bsg_request_handler(struct request_queue *q, struct Scsi_Host *shost, | |||
3797 | /* check if we have the msgcode value at least */ | 3799 | /* check if we have the msgcode value at least */ |
3798 | if (job->request_len < sizeof(uint32_t)) { | 3800 | if (job->request_len < sizeof(uint32_t)) { |
3799 | BUG_ON(job->reply_len < sizeof(uint32_t)); | 3801 | BUG_ON(job->reply_len < sizeof(uint32_t)); |
3802 | job->reply->reply_payload_rcv_len = 0; | ||
3800 | job->reply->result = -ENOMSG; | 3803 | job->reply->result = -ENOMSG; |
3801 | job->reply_len = sizeof(uint32_t); | 3804 | job->reply_len = sizeof(uint32_t); |
3802 | fc_bsg_jobdone(job); | 3805 | fc_bsg_jobdone(job); |
diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c index 88da97745710..84be62149c6c 100644 --- a/drivers/scsi/sd_dif.c +++ b/drivers/scsi/sd_dif.c | |||
@@ -418,7 +418,7 @@ error: | |||
418 | __func__, virt, phys, be32_to_cpu(sdt->ref_tag), | 418 | __func__, virt, phys, be32_to_cpu(sdt->ref_tag), |
419 | be16_to_cpu(sdt->app_tag)); | 419 | be16_to_cpu(sdt->app_tag)); |
420 | 420 | ||
421 | return -EIO; | 421 | return -EILSEQ; |
422 | } | 422 | } |
423 | 423 | ||
424 | /* | 424 | /* |