hp-wmi: fix error path in hp_wmi_bios_setup()
[profile/ivi/kernel-x86-ivi.git] / drivers / platform / x86 / hp-wmi.c
index 4b7c24c..f41135f 100644 (file)
@@ -382,6 +382,11 @@ static int __init hp_wmi_input_setup(void)
                case KE_SW:
                        set_bit(EV_SW, hp_wmi_input_dev->evbit);
                        set_bit(key->keycode, hp_wmi_input_dev->swbit);
+
+                       /* Set initial dock state */
+                       input_report_switch(hp_wmi_input_dev, key->keycode,
+                                           hp_wmi_dock_state());
+                       input_sync(hp_wmi_input_dev);
                        break;
                }
        }
@@ -428,7 +433,9 @@ static int __init hp_wmi_bios_setup(struct platform_device *device)
                wifi_rfkill->state = hp_wmi_wifi_state();
                wifi_rfkill->toggle_radio = hp_wmi_wifi_set;
                wifi_rfkill->user_claim_unsupported = 1;
-               rfkill_register(wifi_rfkill);
+               err = rfkill_register(wifi_rfkill);
+               if (err)
+                       goto add_sysfs_error;
        }
 
        if (wireless & 0x2) {
@@ -438,7 +445,9 @@ static int __init hp_wmi_bios_setup(struct platform_device *device)
                bluetooth_rfkill->state = hp_wmi_bluetooth_state();
                bluetooth_rfkill->toggle_radio = hp_wmi_bluetooth_set;
                bluetooth_rfkill->user_claim_unsupported = 1;
-               rfkill_register(bluetooth_rfkill);
+               err = rfkill_register(bluetooth_rfkill);
+               if (err)
+                       goto register_bluetooth_error;
        }
 
        if (wireless & 0x4) {
@@ -447,10 +456,18 @@ static int __init hp_wmi_bios_setup(struct platform_device *device)
                wwan_rfkill->state = hp_wmi_wwan_state();
                wwan_rfkill->toggle_radio = hp_wmi_wwan_set;
                wwan_rfkill->user_claim_unsupported = 1;
-               rfkill_register(wwan_rfkill);
+               err = rfkill_register(wwan_rfkill);
+               if (err)
+                       goto register_wwan_err;
        }
 
        return 0;
+register_wwan_err:
+       if (bluetooth_rfkill)
+               rfkill_unregister(bluetooth_rfkill);
+register_bluetooth_error:
+       if (wifi_rfkill)
+               rfkill_unregister(wifi_rfkill);
 add_sysfs_error:
        cleanup_sysfs(device);
        return err;