diff options
-rw-r--r-- | drivers/scsi/hosts.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index ba9af4a2bd2a..9ab94adbddb7 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
@@ -246,10 +246,6 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, | |||
246 | 246 | ||
247 | shost->dma_dev = dma_dev; | 247 | shost->dma_dev = dma_dev; |
248 | 248 | ||
249 | error = device_add(&shost->shost_gendev); | ||
250 | if (error) | ||
251 | goto out_destroy_freelist; | ||
252 | |||
253 | /* | 249 | /* |
254 | * Increase usage count temporarily here so that calling | 250 | * Increase usage count temporarily here so that calling |
255 | * scsi_autopm_put_host() will trigger runtime idle if there is | 251 | * scsi_autopm_put_host() will trigger runtime idle if there is |
@@ -260,6 +256,10 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, | |||
260 | pm_runtime_enable(&shost->shost_gendev); | 256 | pm_runtime_enable(&shost->shost_gendev); |
261 | device_enable_async_suspend(&shost->shost_gendev); | 257 | device_enable_async_suspend(&shost->shost_gendev); |
262 | 258 | ||
259 | error = device_add(&shost->shost_gendev); | ||
260 | if (error) | ||
261 | goto out_destroy_freelist; | ||
262 | |||
263 | scsi_host_set_state(shost, SHOST_RUNNING); | 263 | scsi_host_set_state(shost, SHOST_RUNNING); |
264 | get_device(shost->shost_gendev.parent); | 264 | get_device(shost->shost_gendev.parent); |
265 | 265 | ||
@@ -309,6 +309,10 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, | |||
309 | out_del_gendev: | 309 | out_del_gendev: |
310 | device_del(&shost->shost_gendev); | 310 | device_del(&shost->shost_gendev); |
311 | out_destroy_freelist: | 311 | out_destroy_freelist: |
312 | device_disable_async_suspend(&shost->shost_gendev); | ||
313 | pm_runtime_disable(&shost->shost_gendev); | ||
314 | pm_runtime_set_suspended(&shost->shost_gendev); | ||
315 | pm_runtime_put_noidle(&shost->shost_gendev); | ||
312 | scsi_destroy_command_freelist(shost); | 316 | scsi_destroy_command_freelist(shost); |
313 | out_destroy_tags: | 317 | out_destroy_tags: |
314 | if (shost_use_blk_mq(shost)) | 318 | if (shost_use_blk_mq(shost)) |