cnss2: Avoid dereferencing pointer before NULL check

Only dereference pci_priv pointer after NULL check.

Change-Id: I773cb4ae07599b737391ced3e67e4b1ad177b4f1
Signed-off-by: Yue Ma <yuem@codeaurora.org>
This commit is contained in:
Yue Ma 2020-09-17 18:27:38 -07:00
commit 0bb0ef6ed8

View file

@ -4401,17 +4401,16 @@ static void cnss_dev_rddm_timeout_hdlr(struct timer_list *t)
{
struct cnss_pci_data *pci_priv =
from_timer(pci_priv, t, dev_rddm_timer);
struct mhi_controller *mhi_ctrl = pci_priv->mhi_ctrl;
if (!pci_priv)
return;
cnss_fatal_err("Timeout waiting for RDDM notification\n");
if (mhi_get_exec_env(mhi_ctrl) == MHI_EE_PBL)
if (mhi_get_exec_env(pci_priv->mhi_ctrl) == MHI_EE_PBL)
cnss_pr_err("Unable to collect ramdumps due to abrupt reset\n");
mhi_debug_reg_dump(mhi_ctrl);
mhi_debug_reg_dump(pci_priv->mhi_ctrl);
cnss_schedule_recovery(&pci_priv->pci_dev->dev, CNSS_REASON_TIMEOUT);
}