diff mbox

[v2] wlcore: sdio: check for valid platform device data before suspend

Message ID 1527496602-25214-1-git-send-email-eyalr@ti.com (mailing list archive)
State Accepted
Commit 6e91d48371e79862ea2c05867aaebe4afe55a865
Delegated to: Kalle Valo
Headers show

Commit Message

Eyal Reizer May 28, 2018, 8:36 a.m. UTC
the wl pointer can be null In case only wlcore_sdio is probed while
no WiLink module is successfully probed, as in the case of mounting a
wl12xx module while using a device tree file configured with wl18xx
related settings.
In this case the system was crashing in wl1271_suspend() as platform
device data is not set.
Make sure wl the pointer is valid before using it.

Signed-off-by: Eyal Reizer <eyalr@ti.com>
---
Changes since v1: Remove extra characters after signed-of-by

 drivers/net/wireless/ti/wlcore/sdio.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Kalle Valo May 29, 2018, 7:21 a.m. UTC | #1
Eyal Reizer <eyalreizer@gmail.com> wrote:

> the wl pointer can be null In case only wlcore_sdio is probed while
> no WiLink module is successfully probed, as in the case of mounting a
> wl12xx module while using a device tree file configured with wl18xx
> related settings.
> In this case the system was crashing in wl1271_suspend() as platform
> device data is not set.
> Make sure wl the pointer is valid before using it.
> 
> Signed-off-by: Eyal Reizer <eyalr@ti.com>

Patch applied to wireless-drivers-next.git, thanks.

6e91d48371e7 wlcore: sdio: check for valid platform device data before suspend
diff mbox

Patch

diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c
index da701cd..aec6225 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -406,6 +406,11 @@  static int wl1271_suspend(struct device *dev)
 	mmc_pm_flag_t sdio_flags;
 	int ret = 0;
 
+	if (!wl) {
+		dev_err(dev, "no wilink module was probed\n");
+		goto out;
+	}
+
 	dev_dbg(dev, "wl1271 suspend. wow_enabled: %d\n",
 		wl->wow_enabled);