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

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

mmc: cmdq_hci: Fix NULL pointer dereference crash



Add a check on cmdq_host->ops to avoid NULL pointer
dereference, if sdhci_dumpregs is called before
initializing cmdq_host->ops structure.

Change-Id: Idd1794e162c7a53cc63504e15e6e490481f104a3
Signed-off-by: default avatarRitesh Harjani <riteshh@codeaurora.org>
parent fb0c7e34
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -215,7 +215,7 @@ struct cmdq_host_ops {

static inline void cmdq_writel(struct cmdq_host *host, u32 val, int reg)
{
	if (unlikely(host->ops->write_l))
	if (unlikely(host->ops && host->ops->write_l))
		host->ops->write_l(host, val, reg);
	else
		writel_relaxed(val, host->mmio + reg);
@@ -223,7 +223,7 @@ static inline void cmdq_writel(struct cmdq_host *host, u32 val, int reg)

static inline u32 cmdq_readl(struct cmdq_host *host, int reg)
{
	if (unlikely(host->ops->read_l))
	if (unlikely(host->ops && host->ops->read_l))
		return host->ops->read_l(host, reg);
	else
		return readl_relaxed(host->mmio + reg);