diff options
author | Ritesh Harjani <riteshh@codeaurora.org> | 2015-12-30 15:53:49 +0530 |
---|---|---|
committer | Subhash Jadavani <subhashj@codeaurora.org> | 2016-05-31 15:28:08 -0700 |
commit | 9726132b51fd877e2fcf571bc9d7f3b7e873e63b (patch) | |
tree | b25b764c39e2a398919dc5f7e56d203141a41141 /drivers | |
parent | 211eedb1b548ee26f50946599265fc91765f6c26 (diff) |
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: Ritesh Harjani <riteshh@codeaurora.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/host/cmdq_hci.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mmc/host/cmdq_hci.h b/drivers/mmc/host/cmdq_hci.h index 53096fb3a2aa..91cb25b78481 100644 --- a/drivers/mmc/host/cmdq_hci.h +++ b/drivers/mmc/host/cmdq_hci.h @@ -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); |