Commit 7d05652c authored by Chandra S Gorentla's avatar Chandra S Gorentla Committed by Greg Kroah-Hartman
Browse files

drivers: staging: wilc1000: Add check for SPI availability



NULL pointer deference is observed in the wilc1000.ko module
with bus type SPI and when SPI is not ready.

Signed-off-by: default avatarChandra S Gorentla <csgorentla@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8fec2ee4
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1634,6 +1634,12 @@ int mac_open(struct net_device *ndev)
	int i = 0;
	struct WILC_WFI_priv *priv;

#ifdef WILC_SPI
	if (!g_linux_wlan || !g_linux_wlan->wilc_spidev) {
		netdev_err(ndev, "wilc1000: SPI device not ready\n");
		return -ENODEV;
	}
#endif
	nic = netdev_priv(ndev);
	priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
	PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev);