Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 96e9002e authored by Ritesh Harjani's avatar Ritesh Harjani Committed by Gerrit - the friendly Code Review server
Browse files

mmc: sdhci-msm: Fix NULL pointer dereference



If during early boot register dump is called, then
there could be a NULL pointer dereference since mmc_host
structure might not be populated with cq_host info.
Thus fix this by using sdhci_host to get cq_host structure info
in sdhci_msm_cmdq_dump_debug_ram.

Change-Id: Ieaca7887001daabd4a6a0b05f7b0048dc11bbeee
Signed-off-by: default avatarRitesh Harjani <riteshh@codeaurora.org>
parent 5f47fa47
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -3020,10 +3020,13 @@ static void sdhci_msm_set_uhs_signaling(struct sdhci_host *host,

#define MAX_TEST_BUS 60
#define DRV_NAME "cmdq-host"
static void sdhci_msm_cmdq_dump_debug_ram(struct sdhci_msm_host *msm_host)
static void sdhci_msm_cmdq_dump_debug_ram(struct sdhci_host *host)
{
	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
	struct sdhci_msm_host *msm_host = pltfm_host->priv;
	int i = 0;
	struct cmdq_host *cq_host = mmc_cmdq_private(msm_host->mmc);
	struct cmdq_host *cq_host = host->cq_host;

	u32 version = readl_relaxed(msm_host->core_mem + CORE_MCI_VERSION);
	u16 minor = version & CORE_VERSION_TARGET_MASK;
	/* registers offset changed starting from 4.2.0 */
@@ -3054,7 +3057,7 @@ void sdhci_msm_dump_vendor_regs(struct sdhci_host *host)

	pr_info("----------- VENDOR REGISTER DUMP -----------\n");
	if (host->cq_host)
		sdhci_msm_cmdq_dump_debug_ram(msm_host);
		sdhci_msm_cmdq_dump_debug_ram(host);

	pr_info("Data cnt: 0x%08x | Fifo cnt: 0x%08x | Int sts: 0x%08x\n",
		readl_relaxed(msm_host->core_mem + CORE_MCI_DATA_CNT),