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>
This commit is contained in:
parent
211eedb1b5
commit
9726132b51
1 changed files with 2 additions and 2 deletions
|
@ -215,7 +215,7 @@ struct cmdq_host_ops {
|
||||||
|
|
||||||
static inline void cmdq_writel(struct cmdq_host *host, u32 val, int reg)
|
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);
|
host->ops->write_l(host, val, reg);
|
||||||
else
|
else
|
||||||
writel_relaxed(val, host->mmio + reg);
|
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)
|
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);
|
return host->ops->read_l(host, reg);
|
||||||
else
|
else
|
||||||
return readl_relaxed(host->mmio + reg);
|
return readl_relaxed(host->mmio + reg);
|
||||||
|
|
Loading…
Add table
Reference in a new issue