Commit dd258c00 authored by Dan Carpenter's avatar Dan Carpenter Committed by Matthew Garrett

hp-wmi: check for allocation failures

rfkill_alloc() returns NULL on failure.  Check for it, to make the
static checkers happy.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
parent 121b7b0d
...@@ -634,6 +634,8 @@ static int __devinit hp_wmi_rfkill_setup(struct platform_device *device) ...@@ -634,6 +634,8 @@ static int __devinit hp_wmi_rfkill_setup(struct platform_device *device)
RFKILL_TYPE_WLAN, RFKILL_TYPE_WLAN,
&hp_wmi_rfkill_ops, &hp_wmi_rfkill_ops,
(void *) HPWMI_WIFI); (void *) HPWMI_WIFI);
if (!wifi_rfkill)
return -ENOMEM;
rfkill_init_sw_state(wifi_rfkill, rfkill_init_sw_state(wifi_rfkill,
hp_wmi_get_sw_state(HPWMI_WIFI)); hp_wmi_get_sw_state(HPWMI_WIFI));
rfkill_set_hw_state(wifi_rfkill, rfkill_set_hw_state(wifi_rfkill,
...@@ -648,6 +650,10 @@ static int __devinit hp_wmi_rfkill_setup(struct platform_device *device) ...@@ -648,6 +650,10 @@ static int __devinit hp_wmi_rfkill_setup(struct platform_device *device)
RFKILL_TYPE_BLUETOOTH, RFKILL_TYPE_BLUETOOTH,
&hp_wmi_rfkill_ops, &hp_wmi_rfkill_ops,
(void *) HPWMI_BLUETOOTH); (void *) HPWMI_BLUETOOTH);
if (!bluetooth_rfkill) {
err = -ENOMEM;
goto register_wifi_error;
}
rfkill_init_sw_state(bluetooth_rfkill, rfkill_init_sw_state(bluetooth_rfkill,
hp_wmi_get_sw_state(HPWMI_BLUETOOTH)); hp_wmi_get_sw_state(HPWMI_BLUETOOTH));
rfkill_set_hw_state(bluetooth_rfkill, rfkill_set_hw_state(bluetooth_rfkill,
...@@ -662,6 +668,10 @@ static int __devinit hp_wmi_rfkill_setup(struct platform_device *device) ...@@ -662,6 +668,10 @@ static int __devinit hp_wmi_rfkill_setup(struct platform_device *device)
RFKILL_TYPE_WWAN, RFKILL_TYPE_WWAN,
&hp_wmi_rfkill_ops, &hp_wmi_rfkill_ops,
(void *) HPWMI_WWAN); (void *) HPWMI_WWAN);
if (!wwan_rfkill) {
err = -ENOMEM;
goto register_bluetooth_error;
}
rfkill_init_sw_state(wwan_rfkill, rfkill_init_sw_state(wwan_rfkill,
hp_wmi_get_sw_state(HPWMI_WWAN)); hp_wmi_get_sw_state(HPWMI_WWAN));
rfkill_set_hw_state(wwan_rfkill, rfkill_set_hw_state(wwan_rfkill,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment