iwlwifi: LED initialize before registering
authorTomas Winkler <tomas.winkler@intel.com>
Fri, 28 Mar 2008 23:21:11 +0000 (16:21 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 1 Apr 2008 21:13:19 +0000 (17:13 -0400)
This patch initialize all fields in led before registering it
This fixes oops on initialization

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-led.c

index d59ad1844e25da36a5572495bc2c2b514c9f748f..4fe5ee2ba545af511c322149d24b6fd1205825e9 100644 (file)
@@ -238,18 +238,20 @@ static int iwl_leds_register_led(struct iwl_priv *priv,
        led->led_dev.brightness_set = iwl4965_led_brightness_set;
        led->led_dev.default_trigger = trigger;
 
+       led->priv = priv;
+       led->type = type;
+
        ret = led_classdev_register(device, &led->led_dev);
        if (ret) {
                IWL_ERROR("Error: failed to register led handler.\n");
                return ret;
        }
 
-       led->priv = priv;
-       led->type = type;
        led->registered = 1;
 
        if (set_led && led->led_on)
                led->led_on(priv, IWL_LED_LINK);
+
        return 0;
 }