hp-wmi: Fix gps support in hp_wmi_rfkill_setup()
PATCH 1/1 hp-wmi: Fix gps support in hp_wmi_rfkill_setup()
Current gps support in hp_wmi_rfkill_setup() looks like bad copy/past. It leads to kernel panic on my HP530 laptop. So I did:
1)Fix wwan/gps register_*_error label order 2)Fix rfkill_set_hw_state() wrong argument in case of gps
--- drivers/platform/x86/hp-wmi.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/platform/x86/hp-wmi.c +9 -9
@@ -658,7 +658,7 @@ static int hp_wmi_rfkill_setup(struct platform_device *device) (void *) HPWMI_WWAN);if (!wwan_rfkill) { err = -ENOMEM ; - goto register_gps_error; + goto register_bluetooth_error; }rfkill_init_sw_state (wwan_rfkill,hp_wmi_get_sw_state (HPWMI_WWAN ));
@@ -666,7 +666,7 @@ static int hp_wmi_rfkill_setup(struct platform_device *device) hp_wmi_get_hw_state(HPWMI_WWAN)); err =rfkill_register (wwan_rfkill);if (err) - goto register_wwan_err; + goto register_wwan_error; }if (wireless &0x8 ) {
@@ -676,11 +676,11 @@ static int hp_wmi_rfkill_setup(struct platform_device *device) (void *) HPWMI_GPS);if (!gps_rfkill) { err = -ENOMEM ; - goto register_bluetooth_error; + goto register_wwan_error; }rfkill_init_sw_state (gps_rfkill,hp_wmi_get_sw_state (HPWMI_GPS )); -rfkill_set_hw_state (bluetooth_rfkill, +rfkill_set_hw_state (gps_rfkill,hp_wmi_get_hw_state (HPWMI_GPS )); err =rfkill_register (gps_rfkill);if (err)
@@ -688,16 +688,16 @@ static int hp_wmi_rfkill_setup(struct platform_device *device) }return 0 ; -register_wwan_err: -rfkill_destroy (wwan_rfkill); - wwan_rfkill =NULL ; -if (gps_rfkill) -rfkill_unregister (gps_rfkill); register_gps_error:rfkill_destroy (gps_rfkill); gps_rfkill =NULL ;if (bluetooth_rfkill)rfkill_unregister (bluetooth_rfkill); +register_wwan_error: +rfkill_destroy (wwan_rfkill); + wwan_rfkill =NULL ; +if (gps_rfkill) +rfkill_unregister (gps_rfkill); register_bluetooth_error:rfkill_destroy (bluetooth_rfkill); bluetooth_rfkill =NULL ;
One more error.. I'll resend patch to x86-platform mailing list
01.06.2013, 01:53, "Kirill Tkhai" <[email protected]>:
Quoted 70 lines
Current gps support in
hp_wmi_rfkill_setup()looks like bad copy/past. It leads to kernel panic on my HP530 laptop. So I did:1)Fix wwan/gps register_*_error label order 2)Fix
rfkill_set_hw_state()wrong argument in case of gpsSigned-off-by Kirill Tkhai <[email protected]>CC Matthew Garrett <[email protected]>CC Trepák Vilmos <[email protected]>---
drivers/platform/x86/hp-wmi.c | 18 +++++++++---------1 file changed, 9 insertions(+), 9 deletions(-)drivers/platform/x86/hp-wmi.c +4
-9@@ -658,7 +658,7 @@ static int hp_wmi_rfkill_setup(struct platform_device *device) (void *) HPWMI_WWAN); if (!wwan_rfkill) { err = -ENOMEM; - goto register_gps_error; + goto register_bluetooth_error; } rfkill_init_sw_state(wwan_rfkill, hp_wmi_get_sw_state(HPWMI_WWAN));@@ -666,7 +666,7 @@ static int hp_wmi_rfkill_setup(struct platform_device *device) hp_wmi_get_hw_state(HPWMI_WWAN)); err = rfkill_register(wwan_rfkill); if (err) - goto register_wwan_err; + goto register_wwan_error; } if (wireless & 0x8) {@@ -676,11 +676,11 @@ static int hp_wmi_rfkill_setup(struct platform_device *device) (void *) HPWMI_GPS); if (!gps_rfkill) { err = -ENOMEM; - goto register_bluetooth_error; + goto register_wwan_error; } rfkill_init_sw_state(gps_rfkill, hp_wmi_get_sw_state(HPWMI_GPS)); -rfkill_set_hw_state (bluetooth_rfkill, +rfkill_set_hw_state (gps_rfkill, hp_wmi_get_hw_state(HPWMI_GPS)); err = rfkill_register(gps_rfkill); if (err)@@ -688,16 +688,16 @@ static int hp_wmi_rfkill_setup(struct platform_device *device) } return 0; -register_wwan_err: -rfkill_destroy (wwan_rfkill); - wwan_rfkill =NULL ; -if (gps_rfkill) -rfkill_unregister (gps_rfkill);register_gps_error:
rfkill_destroy(gps_rfkill);gps_rfkill= NULL;
if (bluetooth_rfkill)rfkill_unregister(bluetooth_rfkill); +register_wwan_error:
+rfkill_destroy(wwan_rfkill);
+wwan_rfkill= NULL;
+ if (gps_rfkill)
+rfkill_unregister(gps_rfkill);register_bluetooth_error:
rfkill_destroy(bluetooth_rfkill);bluetooth_rfkill= NULL;