hp-wmi: handle rfkill_register() failure

Compilation of the HP WMI hotkeys code results in the following:

CC [M] drivers/platform/x86/hp-wmi.o
drivers/platform/x86/hp-wmi.c: In function hp_wmi_bios_setup:
drivers/platform/x86/hp-wmi.c:431: warning: ignoring return value of rfkill_register,
declared with attribute warn_unused_result
drivers/platform/x86/hp-wmi.c:441: warning: ignoring return value of rfkill_register,
declared with attribute warn_unused_result
drivers/platform/x86/hp-wmi.c:450: warning: ignoring return value of rfkill_register,
declared with attribute warn_unused_result

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Larry Finger and committed by
Linus Torvalds
fe8e4e03 85c210ed

+12 -3
+12 -3
drivers/platform/x86/hp-wmi.c
··· 428 428 wifi_rfkill->state = hp_wmi_wifi_state(); 429 429 wifi_rfkill->toggle_radio = hp_wmi_wifi_set; 430 430 wifi_rfkill->user_claim_unsupported = 1; 431 - rfkill_register(wifi_rfkill); 431 + err = rfkill_register(wifi_rfkill); 432 + if (err) 433 + goto add_sysfs_error; 432 434 } 433 435 434 436 if (wireless & 0x2) { ··· 440 438 bluetooth_rfkill->state = hp_wmi_bluetooth_state(); 441 439 bluetooth_rfkill->toggle_radio = hp_wmi_bluetooth_set; 442 440 bluetooth_rfkill->user_claim_unsupported = 1; 443 - rfkill_register(bluetooth_rfkill); 441 + err = rfkill_register(bluetooth_rfkill); 442 + goto register_bluetooth_error; 444 443 } 445 444 446 445 if (wireless & 0x4) { ··· 450 447 wwan_rfkill->state = hp_wmi_wwan_state(); 451 448 wwan_rfkill->toggle_radio = hp_wmi_wwan_set; 452 449 wwan_rfkill->user_claim_unsupported = 1; 453 - rfkill_register(wwan_rfkill); 450 + err = rfkill_register(wwan_rfkill); 451 + if (err) 452 + goto register_wwan_err; 454 453 } 455 454 456 455 return 0; 456 + register_wwan_err: 457 + rfkill_unregister(bluetooth_rfkill); 458 + register_bluetooth_error: 459 + rfkill_unregister(wifi_rfkill); 457 460 add_sysfs_error: 458 461 cleanup_sysfs(device); 459 462 return err;