Hello James Smart,
The patch cdb42becdd40: "scsi: lpfc: Replace io_channels for nvme and
fcp with general hdw_queues per cpu" from Jan 28, 2019, leads to the
following static checker warning:
drivers/scsi/lpfc/lpfc_init.c:11136 lpfc_sli4_hba_unset()
error: we previously assumed 'phba->pport' could be null (see line
11074)
drivers/scsi/lpfc/lpfc_init.c
11065 static void
11066 lpfc_sli4_hba_unset(struct lpfc_hba *phba)
11067 {
11068 int wait_cnt = 0;
11069 LPFC_MBOXQ_t *mboxq;
11070 struct pci_dev *pdev = phba->pcidev;
11071
11072 lpfc_stop_hba_timers(phba);
11073 if (phba->pport)
^^^^^^^^^^^
New check for NULL.
11074 phba->sli4_hba.intr_enable = 0;
11075
11076 /*
11077 * Gracefully wait out the potential current outstanding
asynchronous
11078 * mailbox command.
11079 */
11080
11081 /* First, block any pending async mailbox command from posted */
11082 spin_lock_irq(&phba->hbalock);
11083 phba->sli.sli_flag |= LPFC_SLI_ASYNC_MBX_BLK;
11084 spin_unlock_irq(&phba->hbalock);
11085 /* Now, trying to wait it out if we can */
11086 while (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) {
11087 msleep(10);
11088 if (++wait_cnt > LPFC_ACTIVE_MBOX_WAIT_CNT)
11089 break;
11090 }
11091 /* Forcefully release the outstanding mailbox command if timed
out */
11092 if (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) {
11093 spin_lock_irq(&phba->hbalock);
11094 mboxq = phba->sli.mbox_active;
11095 mboxq->u.mb.mbxStatus = MBX_NOT_FINISHED;
11096 __lpfc_mbox_cmpl_put(phba, mboxq);
11097 phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE;
11098 phba->sli.mbox_active = NULL;
11099 spin_unlock_irq(&phba->hbalock);
11100 }
11101
11102 /* Abort all iocbs associated with the hba */
11103 lpfc_sli_hba_iocb_abort(phba);
11104
11105 /* Wait for completion of device XRI exchange busy */
11106 lpfc_sli4_xri_exchange_busy_wait(phba);
11107
11108 /* Disable PCI subsystem interrupt */
11109 lpfc_sli4_disable_intr(phba);
11110
11111 /* Disable SR-IOV if enabled */
11112 if (phba->cfg_sriov_nr_virtfn)
11113 pci_disable_sriov(pdev);
11114
11115 /* Stop kthread signal shall trigger work_done one more time */
11116 kthread_stop(phba->worker_thread);
11117
11118 /* Disable FW logging to host memory */
11119 lpfc_ras_stop_fwlog(phba);
11120
11121 /* Unset the queues shared with the hardware then release all
11122 * allocated resources.
11123 */
11124 lpfc_sli4_queue_unset(phba);
11125 lpfc_sli4_queue_destroy(phba);
11126
11127 /* Reset SLI4 HBA FCoE function */
11128 lpfc_pci_function_reset(phba);
11129
11130 /* Free RAS DMA memory */
11131 if (phba->ras_fwlog.ras_enabled)
11132 lpfc_sli4_ras_dma_free(phba);
11133
11134 /* Stop the SLI4 device port */
--> 11135 phba->pport->work_port_events = 0;
^^^^^^^^^^^^^
Unchecked dereference.
11136 }
regards,
dan carpenter