diff options
author | Kalle Valo <kalle.valo@nokia.com> | 2009-06-12 07:16:32 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 14:57:47 -0400 |
commit | c5483b71936333ba9474f57d0f3a7a7abf9b87a0 (patch) | |
tree | 599a485034698c38a2071528a0c57f5f547d152a /drivers/net/wireless/wl12xx/main.c | |
parent | 01d9cfbdaadc64a46b57437c989bbad241074135 (diff) |
wl12xx: check if elp wakeup failed
Check the return call from wl12xx_ps_elp_wakeup() and bail out if it
fails. This shouldn't happen, but if does there's a fundamental low
level issue.
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Reviewed-by: Vidhya Govindan <vidhya.govindan@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/main.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/main.c | 66 |
1 files changed, 45 insertions, 21 deletions
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c index 894d5cc43d25..245544e6434c 100644 --- a/drivers/net/wireless/wl12xx/main.c +++ b/drivers/net/wireless/wl12xx/main.c | |||
@@ -239,14 +239,18 @@ static void wl12xx_filter_work(struct work_struct *work) | |||
239 | if (wl->state == WL12XX_STATE_OFF) | 239 | if (wl->state == WL12XX_STATE_OFF) |
240 | goto out; | 240 | goto out; |
241 | 241 | ||
242 | wl12xx_ps_elp_wakeup(wl); | 242 | ret = wl12xx_ps_elp_wakeup(wl); |
243 | if (ret < 0) | ||
244 | goto out; | ||
243 | 245 | ||
244 | ret = wl12xx_cmd_join(wl, wl->bss_type, 1, 100, 0); | 246 | ret = wl12xx_cmd_join(wl, wl->bss_type, 1, 100, 0); |
245 | if (ret < 0) | 247 | if (ret < 0) |
246 | goto out; | 248 | goto out_sleep; |
247 | 249 | ||
248 | out: | 250 | out_sleep: |
249 | wl12xx_ps_elp_sleep(wl); | 251 | wl12xx_ps_elp_sleep(wl); |
252 | |||
253 | out: | ||
250 | mutex_unlock(&wl->mutex); | 254 | mutex_unlock(&wl->mutex); |
251 | } | 255 | } |
252 | 256 | ||
@@ -524,20 +528,22 @@ static int wl12xx_op_config(struct ieee80211_hw *hw, u32 changed) | |||
524 | 528 | ||
525 | mutex_lock(&wl->mutex); | 529 | mutex_lock(&wl->mutex); |
526 | 530 | ||
527 | wl12xx_ps_elp_wakeup(wl); | 531 | ret = wl12xx_ps_elp_wakeup(wl); |
532 | if (ret < 0) | ||
533 | goto out; | ||
528 | 534 | ||
529 | if (channel != wl->channel) { | 535 | if (channel != wl->channel) { |
530 | /* FIXME: use beacon interval provided by mac80211 */ | 536 | /* FIXME: use beacon interval provided by mac80211 */ |
531 | ret = wl12xx_cmd_join(wl, wl->bss_type, 1, 100, 0); | 537 | ret = wl12xx_cmd_join(wl, wl->bss_type, 1, 100, 0); |
532 | if (ret < 0) | 538 | if (ret < 0) |
533 | goto out; | 539 | goto out_sleep; |
534 | 540 | ||
535 | wl->channel = channel; | 541 | wl->channel = channel; |
536 | } | 542 | } |
537 | 543 | ||
538 | ret = wl12xx_build_null_data(wl); | 544 | ret = wl12xx_build_null_data(wl); |
539 | if (ret < 0) | 545 | if (ret < 0) |
540 | goto out; | 546 | goto out_sleep; |
541 | 547 | ||
542 | if (conf->flags & IEEE80211_CONF_PS && !wl->psm_requested) { | 548 | if (conf->flags & IEEE80211_CONF_PS && !wl->psm_requested) { |
543 | wl12xx_info("psm enabled"); | 549 | wl12xx_info("psm enabled"); |
@@ -568,9 +574,12 @@ static int wl12xx_op_config(struct ieee80211_hw *hw, u32 changed) | |||
568 | wl->power_level = conf->power_level; | 574 | wl->power_level = conf->power_level; |
569 | } | 575 | } |
570 | 576 | ||
571 | out: | 577 | out_sleep: |
572 | wl12xx_ps_elp_sleep(wl); | 578 | wl12xx_ps_elp_sleep(wl); |
579 | |||
580 | out: | ||
573 | mutex_unlock(&wl->mutex); | 581 | mutex_unlock(&wl->mutex); |
582 | |||
574 | return ret; | 583 | return ret; |
575 | } | 584 | } |
576 | 585 | ||
@@ -708,7 +717,9 @@ static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
708 | 717 | ||
709 | mutex_lock(&wl->mutex); | 718 | mutex_lock(&wl->mutex); |
710 | 719 | ||
711 | wl12xx_ps_elp_wakeup(wl); | 720 | ret = wl12xx_ps_elp_wakeup(wl); |
721 | if (ret < 0) | ||
722 | goto out_unlock; | ||
712 | 723 | ||
713 | switch (cmd) { | 724 | switch (cmd) { |
714 | case SET_KEY: | 725 | case SET_KEY: |
@@ -725,7 +736,7 @@ static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
725 | ret = wl12xx_set_key_type(wl, wl_cmd, cmd, key, addr); | 736 | ret = wl12xx_set_key_type(wl, wl_cmd, cmd, key, addr); |
726 | if (ret < 0) { | 737 | if (ret < 0) { |
727 | wl12xx_error("Set KEY type failed"); | 738 | wl12xx_error("Set KEY type failed"); |
728 | goto out_unlock; | 739 | goto out_sleep; |
729 | } | 740 | } |
730 | 741 | ||
731 | if (wl_cmd->key_type != KEY_WEP_DEFAULT) | 742 | if (wl_cmd->key_type != KEY_WEP_DEFAULT) |
@@ -756,11 +767,13 @@ static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
756 | ret = wl12xx_cmd_send(wl, CMD_SET_KEYS, wl_cmd, sizeof(*wl_cmd)); | 767 | ret = wl12xx_cmd_send(wl, CMD_SET_KEYS, wl_cmd, sizeof(*wl_cmd)); |
757 | if (ret < 0) { | 768 | if (ret < 0) { |
758 | wl12xx_warning("could not set keys"); | 769 | wl12xx_warning("could not set keys"); |
759 | goto out_unlock; | 770 | goto out_sleep; |
760 | } | 771 | } |
761 | 772 | ||
762 | out_unlock: | 773 | out_sleep: |
763 | wl12xx_ps_elp_sleep(wl); | 774 | wl12xx_ps_elp_sleep(wl); |
775 | |||
776 | out_unlock: | ||
764 | mutex_unlock(&wl->mutex); | 777 | mutex_unlock(&wl->mutex); |
765 | 778 | ||
766 | out: | 779 | out: |
@@ -955,11 +968,16 @@ static int wl12xx_op_hw_scan(struct ieee80211_hw *hw, | |||
955 | } | 968 | } |
956 | 969 | ||
957 | mutex_lock(&wl->mutex); | 970 | mutex_lock(&wl->mutex); |
958 | wl12xx_ps_elp_wakeup(wl); | 971 | |
972 | ret = wl12xx_ps_elp_wakeup(wl); | ||
973 | if (ret < 0) | ||
974 | goto out; | ||
959 | 975 | ||
960 | ret = wl12xx_hw_scan(hw->priv, ssid, ssid_len, 1, 0, 13, 3); | 976 | ret = wl12xx_hw_scan(hw->priv, ssid, ssid_len, 1, 0, 13, 3); |
961 | 977 | ||
962 | wl12xx_ps_elp_sleep(wl); | 978 | wl12xx_ps_elp_sleep(wl); |
979 | |||
980 | out: | ||
963 | mutex_unlock(&wl->mutex); | 981 | mutex_unlock(&wl->mutex); |
964 | 982 | ||
965 | return ret; | 983 | return ret; |
@@ -972,15 +990,17 @@ static int wl12xx_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value) | |||
972 | 990 | ||
973 | mutex_lock(&wl->mutex); | 991 | mutex_lock(&wl->mutex); |
974 | 992 | ||
975 | wl12xx_ps_elp_wakeup(wl); | 993 | ret = wl12xx_ps_elp_wakeup(wl); |
994 | if (ret < 0) | ||
995 | goto out; | ||
976 | 996 | ||
977 | ret = wl12xx_acx_rts_threshold(wl, (u16) value); | 997 | ret = wl12xx_acx_rts_threshold(wl, (u16) value); |
978 | |||
979 | if (ret < 0) | 998 | if (ret < 0) |
980 | wl12xx_warning("wl12xx_op_set_rts_threshold failed: %d", ret); | 999 | wl12xx_warning("wl12xx_op_set_rts_threshold failed: %d", ret); |
981 | 1000 | ||
982 | wl12xx_ps_elp_sleep(wl); | 1001 | wl12xx_ps_elp_sleep(wl); |
983 | 1002 | ||
1003 | out: | ||
984 | mutex_unlock(&wl->mutex); | 1004 | mutex_unlock(&wl->mutex); |
985 | 1005 | ||
986 | return ret; | 1006 | return ret; |
@@ -1000,7 +1020,9 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1000 | 1020 | ||
1001 | mutex_lock(&wl->mutex); | 1021 | mutex_lock(&wl->mutex); |
1002 | 1022 | ||
1003 | wl12xx_ps_elp_wakeup(wl); | 1023 | ret = wl12xx_ps_elp_wakeup(wl); |
1024 | if (ret < 0) | ||
1025 | goto out; | ||
1004 | 1026 | ||
1005 | if (changed & BSS_CHANGED_ASSOC) { | 1027 | if (changed & BSS_CHANGED_ASSOC) { |
1006 | if (bss_conf->assoc) { | 1028 | if (bss_conf->assoc) { |
@@ -1008,18 +1030,18 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1008 | 1030 | ||
1009 | ret = wl12xx_build_ps_poll(wl, wl->aid); | 1031 | ret = wl12xx_build_ps_poll(wl, wl->aid); |
1010 | if (ret < 0) | 1032 | if (ret < 0) |
1011 | goto out; | 1033 | goto out_sleep; |
1012 | 1034 | ||
1013 | ret = wl12xx_acx_aid(wl, wl->aid); | 1035 | ret = wl12xx_acx_aid(wl, wl->aid); |
1014 | if (ret < 0) | 1036 | if (ret < 0) |
1015 | goto out; | 1037 | goto out_sleep; |
1016 | 1038 | ||
1017 | /* If we want to go in PSM but we're not there yet */ | 1039 | /* If we want to go in PSM but we're not there yet */ |
1018 | if (wl->psm_requested && !wl->psm) { | 1040 | if (wl->psm_requested && !wl->psm) { |
1019 | mode = STATION_POWER_SAVE_MODE; | 1041 | mode = STATION_POWER_SAVE_MODE; |
1020 | ret = wl12xx_ps_set_mode(wl, mode); | 1042 | ret = wl12xx_ps_set_mode(wl, mode); |
1021 | if (ret < 0) | 1043 | if (ret < 0) |
1022 | goto out; | 1044 | goto out_sleep; |
1023 | } | 1045 | } |
1024 | } | 1046 | } |
1025 | } | 1047 | } |
@@ -1030,7 +1052,7 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1030 | ret = wl12xx_acx_slot(wl, SLOT_TIME_LONG); | 1052 | ret = wl12xx_acx_slot(wl, SLOT_TIME_LONG); |
1031 | if (ret < 0) { | 1053 | if (ret < 0) { |
1032 | wl12xx_warning("Set slot time failed %d", ret); | 1054 | wl12xx_warning("Set slot time failed %d", ret); |
1033 | goto out; | 1055 | goto out_sleep; |
1034 | } | 1056 | } |
1035 | } | 1057 | } |
1036 | 1058 | ||
@@ -1048,7 +1070,7 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1048 | ret = wl12xx_acx_cts_protect(wl, CTSPROTECT_DISABLE); | 1070 | ret = wl12xx_acx_cts_protect(wl, CTSPROTECT_DISABLE); |
1049 | if (ret < 0) { | 1071 | if (ret < 0) { |
1050 | wl12xx_warning("Set ctsprotect failed %d", ret); | 1072 | wl12xx_warning("Set ctsprotect failed %d", ret); |
1051 | goto out; | 1073 | goto out_sleep; |
1052 | } | 1074 | } |
1053 | } | 1075 | } |
1054 | 1076 | ||
@@ -1090,8 +1112,10 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1090 | goto out; | 1112 | goto out; |
1091 | } | 1113 | } |
1092 | 1114 | ||
1093 | out: | 1115 | out_sleep: |
1094 | wl12xx_ps_elp_sleep(wl); | 1116 | wl12xx_ps_elp_sleep(wl); |
1117 | |||
1118 | out: | ||
1095 | mutex_unlock(&wl->mutex); | 1119 | mutex_unlock(&wl->mutex); |
1096 | } | 1120 | } |
1097 | 1121 | ||