Commit 69097a63 authored by Yihang Li's avatar Yihang Li Committed by Martin K. Petersen

scsi: hisi_sas: Check whether debugfs is enabled before removing or releasing it

hisi_sas debugfs remove should be executed only when debugfs is enabled.
Check whether debugfs is enabled and then remove it only if enabled.
Signed-off-by: default avatarYihang Li <liyihang9@huawei.com>
Signed-off-by: default avatarXiang Chen <chenxiang66@hisilicon.com>
Link: https://lore.kernel.org/r/1705904747-62186-4-git-send-email-chenxiang66@hisilicon.comSigned-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 3f030550
......@@ -2625,7 +2625,8 @@ static __exit void hisi_sas_exit(void)
{
sas_release_transport(hisi_sas_stt);
debugfs_remove(hisi_sas_debugfs_dir);
if (hisi_sas_debugfs_enable)
debugfs_remove(hisi_sas_debugfs_dir);
}
module_init(hisi_sas_init);
......
......@@ -4902,7 +4902,8 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
err_out_remove_host:
scsi_remove_host(shost);
err_out_undo_debugfs:
debugfs_exit_v3_hw(hisi_hba);
if (hisi_sas_debugfs_enable)
debugfs_exit_v3_hw(hisi_hba);
err_out_free_host:
hisi_sas_free(hisi_hba);
scsi_host_put(shost);
......@@ -4942,7 +4943,9 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev)
hisi_sas_v3_destroy_irqs(pdev, hisi_hba);
hisi_sas_free(hisi_hba);
debugfs_exit_v3_hw(hisi_hba);
if (hisi_sas_debugfs_enable)
debugfs_exit_v3_hw(hisi_hba);
scsi_host_put(shost);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment