Skip to contentSkip to conversation

SCSI: lpfc, don't dereference NULL

PATCH In review Jiri Slaby 2 participants 2 messages Jul 13, 2009 – Jul 15, 2009

Subsystems (2)
lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/1 SCSI: lpfc, don't dereference NULL

When kzalloc fails in lpfc_hba_alloc, don't dereference the NULL by lpfc_printf_log. Use dev_err instead.

---
 drivers/scsi/lpfc/lpfc_init.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +1 -2
index fc67cc6..2452dc9 100644
@@ -4130,8 +4130,7 @@ lpfc_hba_alloc(struct pci_dev *pdev)
 	/* Allocate memory for HBA structure */
 	phba = kzalloc(sizeof(struct lpfc_hba), GFP_KERNEL);
 	if (!phba) {
-		lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-				"1417 Failed to allocate hba struct.\n");
+		dev_err(&pdev->dev, "failed to allocate hba struct\n");
 		return NULL;
 	}
 
Signature · 1 line
1.6.3.2
Acked-by on v1 1/1
#1 lore raw

Thanks Jiri.

-- james s

Quoted 22 lines · Jiri Slaby

When kzalloc fails in lpfc_hba_alloc, don't dereference the NULL by lpfc_printf_log. Use dev_err instead.

---
 drivers/scsi/lpfc/lpfc_init.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +1 -2
index fc67cc6..2452dc9 100644
@@ -4130,8 +4130,7 @@ lpfc_hba_alloc(struct pci_dev *pdev)
 	/* Allocate memory for HBA structure */
 	phba = kzalloc(sizeof(struct lpfc_hba), GFP_KERNEL);
 	if (!phba) {
-		lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-				"1417 Failed to allocate hba struct.\n");
+		dev_err(&pdev->dev, "failed to allocate hba struct\n");
 		return NULL;
 	}