staging: wilc1000: fixed kernel panic when firmware is not started
authorLeo Kim <leo.kim@atmel.com>
Fri, 18 Mar 2016 12:23:16 +0000 (21:23 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Mar 2016 02:22:13 +0000 (22:22 -0400)
This patch fixed the problems caused by if firmware is not started.
That is why, in nl80211 put current TX power in interface info.
If firmware is not started, this function(get_tx_power) does not work.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c

index b76622d1adc31aff3352f3df436cdad68605debe..448a5c8c451460756b7cfbd4dbff757fa48e03a1 100644 (file)
@@ -2170,6 +2170,13 @@ static int get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
        int ret;
        struct wilc_priv *priv = wiphy_priv(wiphy);
        struct wilc_vif *vif = netdev_priv(priv->dev);
+       struct wilc *wl;
+
+       wl = vif->wilc;
+
+       /* If firmware is not started, return. */
+       if (!wl->initialized)
+               return -EIO;
 
        ret = wilc_get_tx_power(vif, (u8 *)dbm);
        if (ret)