aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaciej S. Szmigiero <mail@maciej.szmigiero.name>2016-03-06 17:38:36 -0500
committerDarren Hart <dvhart@linux.intel.com>2016-03-23 13:05:51 -0400
commitc7805e5459f5cac2d99e901e276908c205c3fd3a (patch)
tree0acfce67b2f4e9866445b243b2e35ad34a90a496
parentaaf3a5e77566ad186a85d28a0afd26b8dd0afd11 (diff)
hp-wmi: fix unregister order in hp_wmi_rfkill_setup() once again
rfkill registration order in hp_wmi_rfkill_setup() is: 1) WiFi, 2) BT, 3) WWAN, 5) GPS. Unregistration when cleaning up on error return should happen in reverse order. This means that: If BT rfkill fails to be allocated we possibly need to first unregister WiFi rfkill before destroying it. The same goes with (WWAN, BT) and (GPS, WWAN) pairs. Also, if WWAN rfkill fails to register we need to (possibly) unregister BT not the GPS one. And if GPS rfkill fails to register we need to unregister WWAN not the BT one. We never need to unregister GPS rfkill here since if GPS rfkill registration succeeds this function returns without error so no cleanup is necessary. Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
-rw-r--r--drivers/platform/x86/hp-wmi.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index fb4dd7b3ee71..78cebc0e358c 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -746,7 +746,7 @@ static int __init hp_wmi_rfkill_setup(struct platform_device *device)
746 (void *) HPWMI_BLUETOOTH); 746 (void *) HPWMI_BLUETOOTH);
747 if (!bluetooth_rfkill) { 747 if (!bluetooth_rfkill) {
748 err = -ENOMEM; 748 err = -ENOMEM;
749 goto register_wifi_error; 749 goto register_bluetooth_error;
750 } 750 }
751 rfkill_init_sw_state(bluetooth_rfkill, 751 rfkill_init_sw_state(bluetooth_rfkill,
752 hp_wmi_get_sw_state(HPWMI_BLUETOOTH)); 752 hp_wmi_get_sw_state(HPWMI_BLUETOOTH));
@@ -764,7 +764,7 @@ static int __init hp_wmi_rfkill_setup(struct platform_device *device)
764 (void *) HPWMI_WWAN); 764 (void *) HPWMI_WWAN);
765 if (!wwan_rfkill) { 765 if (!wwan_rfkill) {
766 err = -ENOMEM; 766 err = -ENOMEM;
767 goto register_bluetooth_error; 767 goto register_wwan_error;
768 } 768 }
769 rfkill_init_sw_state(wwan_rfkill, 769 rfkill_init_sw_state(wwan_rfkill,
770 hp_wmi_get_sw_state(HPWMI_WWAN)); 770 hp_wmi_get_sw_state(HPWMI_WWAN));
@@ -782,7 +782,7 @@ static int __init hp_wmi_rfkill_setup(struct platform_device *device)
782 (void *) HPWMI_GPS); 782 (void *) HPWMI_GPS);
783 if (!gps_rfkill) { 783 if (!gps_rfkill) {
784 err = -ENOMEM; 784 err = -ENOMEM;
785 goto register_wwan_error; 785 goto register_gps_error;
786 } 786 }
787 rfkill_init_sw_state(gps_rfkill, 787 rfkill_init_sw_state(gps_rfkill,
788 hp_wmi_get_sw_state(HPWMI_GPS)); 788 hp_wmi_get_sw_state(HPWMI_GPS));
@@ -797,13 +797,13 @@ static int __init hp_wmi_rfkill_setup(struct platform_device *device)
797register_gps_error: 797register_gps_error:
798 rfkill_destroy(gps_rfkill); 798 rfkill_destroy(gps_rfkill);
799 gps_rfkill = NULL; 799 gps_rfkill = NULL;
800 if (bluetooth_rfkill) 800 if (wwan_rfkill)
801 rfkill_unregister(bluetooth_rfkill); 801 rfkill_unregister(wwan_rfkill);
802register_wwan_error: 802register_wwan_error:
803 rfkill_destroy(wwan_rfkill); 803 rfkill_destroy(wwan_rfkill);
804 wwan_rfkill = NULL; 804 wwan_rfkill = NULL;
805 if (gps_rfkill) 805 if (bluetooth_rfkill)
806 rfkill_unregister(gps_rfkill); 806 rfkill_unregister(bluetooth_rfkill);
807register_bluetooth_error: 807register_bluetooth_error:
808 rfkill_destroy(bluetooth_rfkill); 808 rfkill_destroy(bluetooth_rfkill);
809 bluetooth_rfkill = NULL; 809 bluetooth_rfkill = NULL;