ath9k: fix a crash in led init
[openwrt/staging/mkresin.git] / package / mac80211 / patches / 581-ath9k_extra_platform_leds.patch
index 0637269b340ac296f49cf760e07dbc1dc3c7f1a4..3834d43881be6ce2636ed9d3074a9231fd999de8 100644 (file)
  
        INIT_LIST_HEAD(&sc->leds);
  
-@@ -133,6 +154,9 @@ void ath_init_leds(struct ath_softc *sc)
+@@ -133,6 +154,12 @@ void ath_init_leds(struct ath_softc *sc)
                trigger = ieee80211_get_radio_led_name(sc->hw);
  
        ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, 1);
 +
++      if (!pdata)
++              return;
++
 +      for (i = 0; i < pdata->num_leds; i++)
 +              ath_create_platform_led(sc, &pdata->leds[i]);
  }