Skip to content

Commit 7702c7f

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: Call ufshcd_add_scsi_host() later
Call ufshcd_add_scsi_host() after host controller initialization has completed. This is safe because no code between the old and new ufshcd_add_scsi_host() call site depends on the scsi_add_host() call. Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Bean Huo <[email protected]> Reviewed-by: Bao D. Nguyen <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 3192d28 commit 7702c7f

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10528,10 +10528,6 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
1052810528
hba->is_irq_enabled = true;
1052910529
}
1053010530

10531-
err = ufshcd_add_scsi_host(hba);
10532-
if (err)
10533-
goto out_disable;
10534-
1053510531
/* Reset the attached device */
1053610532
ufshcd_device_reset(hba);
1053710533

@@ -10543,7 +10539,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
1054310539
dev_err(hba->dev, "Host controller enable failed\n");
1054410540
ufshcd_print_evt_hist(hba);
1054510541
ufshcd_print_host_state(hba);
10546-
goto free_tmf_queue;
10542+
goto out_disable;
1054710543
}
1054810544

1054910545
/*
@@ -10578,19 +10574,17 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
1057810574
*/
1057910575
ufshcd_set_ufs_dev_active(hba);
1058010576

10577+
err = ufshcd_add_scsi_host(hba);
10578+
if (err)
10579+
goto out_disable;
10580+
1058110581
async_schedule(ufshcd_async_scan, hba);
1058210582
ufs_sysfs_add_nodes(hba->dev);
1058310583

1058410584
device_enable_async_suspend(dev);
1058510585
ufshcd_pm_qos_init(hba);
1058610586
return 0;
1058710587

10588-
free_tmf_queue:
10589-
blk_mq_destroy_queue(hba->tmf_queue);
10590-
blk_put_queue(hba->tmf_queue);
10591-
blk_mq_free_tag_set(&hba->tmf_tag_set);
10592-
if (hba->scsi_host_added)
10593-
scsi_remove_host(hba->host);
1059410588
out_disable:
1059510589
hba->is_irq_enabled = false;
1059610590
ufshcd_hba_exit(hba);

0 commit comments

Comments
 (0)