summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Solaira <gustavos@codeaurora.org>2017-08-18 10:59:47 -0700
committerGustavo Solaira <gustavos@codeaurora.org>2017-08-18 12:52:08 -0700
commitcffd215486b70e0216688ffcf0800110d1becf18 (patch)
tree570ec2974880b5740678d84c2eaa03a591ba1c20
parentcd4e77f1e941600d2ede57ff57c3dfb693566922 (diff)
net: cnss: Fix crash when SDIO device is not inserted
Check to see if the host is not NULL before trying to use it, this avoids a crash when the driver is probed, but the card is not available. Also remove dependency on ARCH_MSM since it is not used anymore. Change-Id: I476a512dd41e0c336b71c96d8dd2972cdadb8732 Signed-off-by: Gustavo Solaira <gustavos@codeaurora.org>
-rw-r--r--drivers/net/wireless/cnss/Kconfig1
-rw-r--r--drivers/net/wireless/cnss/cnss_sdio.c7
2 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/wireless/cnss/Kconfig b/drivers/net/wireless/cnss/Kconfig
index 6faf9f1ef5d0..863f766bccdb 100644
--- a/drivers/net/wireless/cnss/Kconfig
+++ b/drivers/net/wireless/cnss/Kconfig
@@ -46,7 +46,6 @@ config CLD_HL_SDIO_CORE
select WEXT_CORE
select WEXT_SPY
select NL80211_TESTMODE
- depends on ARCH_MSM
depends on MMC
config CLD_LL_CORE
diff --git a/drivers/net/wireless/cnss/cnss_sdio.c b/drivers/net/wireless/cnss/cnss_sdio.c
index ce7dbc64c4c3..8586bb16cfd3 100644
--- a/drivers/net/wireless/cnss/cnss_sdio.c
+++ b/drivers/net/wireless/cnss/cnss_sdio.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -276,6 +276,11 @@ static int cnss_get_hw_resources(struct device *dev)
host = info->host;
+ if (!host) {
+ pr_err("%s: MMC host is invalid\n", __func__);
+ return -ENODEV;
+ }
+
ret = regulator_enable(cnss_pdata->regulator.wlan_vreg);
if (ret) {
pr_err("%s: Failed to enable wlan vreg\n", __func__);