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: Yihang Li <liyihang9@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Link: https://lore.kernel.org/r/1705904747-62186-4-git-send-email-chenxiang66@hisilicon.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: chenyi <chenyi211@huawei.com>
This commit is contained in:
Yihang Li 2024-01-22 14:25:46 +08:00 committed by Jianping Liu
parent 1159f42562
commit ef9fcd99f1
2 changed files with 5 additions and 2 deletions

View File

@ -2947,6 +2947,7 @@ static __exit void hisi_sas_exit(void)
{
sas_release_transport(hisi_sas_stt);
if (hisi_sas_debugfs_enable)
debugfs_remove(hisi_sas_debugfs_dir);
}

View File

@ -5017,7 +5017,9 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev)
hisi_sas_v3_destroy_irqs(pdev, hisi_hba);
hisi_sas_free(hisi_hba);
if (hisi_sas_debugfs_enable)
debugfs_exit_v3_hw(hisi_hba);
scsi_host_put(shost);
}