From: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Date: Fri, 25 Mar 2011 21:24:00 +0000 (-0700)
Subject: [SCSI] be2iscsi: check boot_kset is created before destroying it
X-Git-Tag: firefly_0821_release~7613^2~1373^2~105
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0b1d3cbf51f75eaaabdb904f02362368487e2aa7;p=firefly-linux-kernel-4.4.55.git

[SCSI] be2iscsi: check boot_kset is created before destroying it

Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
---

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 7fe38a49bbb7..91b354daf94b 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -420,7 +420,8 @@ static int beiscsi_setup_boot_info(struct beiscsi_hba *phba)
 	return 0;
 
 free_kset:
-	iscsi_boot_destroy_kset(phba->boot_kset);
+	if (phba->boot_kset)
+		iscsi_boot_destroy_kset(phba->boot_kset);
 	return -ENOMEM;
 }
 
@@ -4144,10 +4145,11 @@ static void beiscsi_remove(struct pci_dev *pcidev)
 			    phba->ctrl.mbox_mem_alloced.size,
 			    phba->ctrl.mbox_mem_alloced.va,
 			    phba->ctrl.mbox_mem_alloced.dma);
+	if (phba->boot_kset)
+		iscsi_boot_destroy_kset(phba->boot_kset);
 	iscsi_host_remove(phba->shost);
 	pci_dev_put(phba->pcidev);
 	iscsi_host_free(phba->shost);
-	iscsi_boot_destroy_kset(phba->boot_kset);
 }
 
 static void beiscsi_msix_enable(struct beiscsi_hba *phba)