From ca95a2bdb5fb8d458613e8cfa8a5a32c5c1565ec Mon Sep 17 00:00:00 2001 From: Sarthak Garg Date: Fri, 20 Nov 2020 13:32:59 +0530 Subject: [PATCH] mmc: core: Dereference dev pointer after NULL check Dereference dev pointer after NULL check. Change-Id: I39bc175eb53ff486577672b1c3175475bbf394e2 Signed-off-by: Sarthak Garg --- drivers/mmc/core/host.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index f05377081ca5..d026652173e5 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -224,12 +224,16 @@ int mmc_of_parse(struct mmc_host *host) bool cd_cap_invert, cd_gpio_invert = false; #if defined(CONFIG_SDC_QTI) const char *lower_bus_speed = NULL; - struct device_node *np = dev->of_node; + struct device_node *np; #endif if (!dev || !dev_fwnode(dev)) return 0; +#if defined(CONFIG_SDC_QTI) + np = dev->of_node; +#endif + /* "bus-width" is translated to MMC_CAP_*_BIT_DATA flags */ if (device_property_read_u32(dev, "bus-width", &bus_width) < 0) { dev_dbg(host->parent,