diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/esp_scsi.c | 8 | ||||
-rw-r--r-- | drivers/scsi/esp_scsi.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c index a0b6d414953d..305eddef5ca1 100644 --- a/drivers/scsi/esp_scsi.c +++ b/drivers/scsi/esp_scsi.c | |||
@@ -2371,6 +2371,7 @@ static int esp_slave_alloc(struct scsi_device *dev) | |||
2371 | dev->hostdata = lp; | 2371 | dev->hostdata = lp; |
2372 | 2372 | ||
2373 | tp->starget = dev->sdev_target; | 2373 | tp->starget = dev->sdev_target; |
2374 | tp->starget_ref++; | ||
2374 | 2375 | ||
2375 | spi_min_period(tp->starget) = esp->min_period; | 2376 | spi_min_period(tp->starget) = esp->min_period; |
2376 | spi_max_offset(tp->starget) = 15; | 2377 | spi_max_offset(tp->starget) = 15; |
@@ -2425,10 +2426,17 @@ static int esp_slave_configure(struct scsi_device *dev) | |||
2425 | 2426 | ||
2426 | static void esp_slave_destroy(struct scsi_device *dev) | 2427 | static void esp_slave_destroy(struct scsi_device *dev) |
2427 | { | 2428 | { |
2429 | struct esp *esp = shost_priv(dev->host); | ||
2430 | struct esp_target_data *tp = &esp->target[dev->id]; | ||
2428 | struct esp_lun_data *lp = dev->hostdata; | 2431 | struct esp_lun_data *lp = dev->hostdata; |
2429 | 2432 | ||
2430 | kfree(lp); | 2433 | kfree(lp); |
2431 | dev->hostdata = NULL; | 2434 | dev->hostdata = NULL; |
2435 | |||
2436 | BUG_ON(tp->starget_ref <= 0); | ||
2437 | |||
2438 | if (!--tp->starget_ref) | ||
2439 | tp->starget = NULL; | ||
2432 | } | 2440 | } |
2433 | 2441 | ||
2434 | static int esp_eh_abort_handler(struct scsi_cmnd *cmd) | 2442 | static int esp_eh_abort_handler(struct scsi_cmnd *cmd) |
diff --git a/drivers/scsi/esp_scsi.h b/drivers/scsi/esp_scsi.h index bb43a1388188..655e0b2240bf 100644 --- a/drivers/scsi/esp_scsi.h +++ b/drivers/scsi/esp_scsi.h | |||
@@ -322,6 +322,7 @@ struct esp_target_data { | |||
322 | u8 nego_goal_tags; | 322 | u8 nego_goal_tags; |
323 | 323 | ||
324 | struct scsi_target *starget; | 324 | struct scsi_target *starget; |
325 | int starget_ref; | ||
325 | }; | 326 | }; |
326 | 327 | ||
327 | struct esp_event_ent { | 328 | struct esp_event_ent { |