diff options
author | Amitkumar Karwar <akarwar@marvell.com> | 2009-10-08 22:38:45 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-27 16:47:55 -0400 |
commit | c0bbd57679efc2350703a1c0f3fc624cbcaba55f (patch) | |
tree | 9d7abd3b727fd64c9ccf782277ce90a6656f861a /drivers | |
parent | be823e5b2d71d367b5e27496e2b19d453e21936e (diff) |
libertas: Check return status of command functions
Return status of lbs_prepare_and_send_command and lbs_cmd_with_response
functions is not checked at some places. Those checks are added.
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/libertas/debugfs.c | 27 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/scan.c | 11 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/wext.c | 10 |
4 files changed, 34 insertions, 16 deletions
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index 893a55ca344a..587b0cb0088d 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c | |||
@@ -451,10 +451,12 @@ static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf, | |||
451 | CMD_MAC_REG_ACCESS, 0, | 451 | CMD_MAC_REG_ACCESS, 0, |
452 | CMD_OPTION_WAITFORRSP, 0, &offval); | 452 | CMD_OPTION_WAITFORRSP, 0, &offval); |
453 | mdelay(10); | 453 | mdelay(10); |
454 | pos += snprintf(buf+pos, len-pos, "MAC[0x%x] = 0x%08x\n", | 454 | if (!ret) { |
455 | pos += snprintf(buf+pos, len-pos, "MAC[0x%x] = 0x%08x\n", | ||
455 | priv->mac_offset, priv->offsetvalue.value); | 456 | priv->mac_offset, priv->offsetvalue.value); |
456 | 457 | ||
457 | ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); | 458 | ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); |
459 | } | ||
458 | free_page(addr); | 460 | free_page(addr); |
459 | return ret; | 461 | return ret; |
460 | } | 462 | } |
@@ -514,7 +516,8 @@ static ssize_t lbs_wrmac_write(struct file *file, | |||
514 | CMD_OPTION_WAITFORRSP, 0, &offval); | 516 | CMD_OPTION_WAITFORRSP, 0, &offval); |
515 | mdelay(10); | 517 | mdelay(10); |
516 | 518 | ||
517 | res = count; | 519 | if (!res) |
520 | res = count; | ||
518 | out_unlock: | 521 | out_unlock: |
519 | free_page(addr); | 522 | free_page(addr); |
520 | return res; | 523 | return res; |
@@ -539,10 +542,12 @@ static ssize_t lbs_rdbbp_read(struct file *file, char __user *userbuf, | |||
539 | CMD_BBP_REG_ACCESS, 0, | 542 | CMD_BBP_REG_ACCESS, 0, |
540 | CMD_OPTION_WAITFORRSP, 0, &offval); | 543 | CMD_OPTION_WAITFORRSP, 0, &offval); |
541 | mdelay(10); | 544 | mdelay(10); |
542 | pos += snprintf(buf+pos, len-pos, "BBP[0x%x] = 0x%08x\n", | 545 | if (!ret) { |
546 | pos += snprintf(buf+pos, len-pos, "BBP[0x%x] = 0x%08x\n", | ||
543 | priv->bbp_offset, priv->offsetvalue.value); | 547 | priv->bbp_offset, priv->offsetvalue.value); |
544 | 548 | ||
545 | ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); | 549 | ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); |
550 | } | ||
546 | free_page(addr); | 551 | free_page(addr); |
547 | 552 | ||
548 | return ret; | 553 | return ret; |
@@ -603,7 +608,8 @@ static ssize_t lbs_wrbbp_write(struct file *file, | |||
603 | CMD_OPTION_WAITFORRSP, 0, &offval); | 608 | CMD_OPTION_WAITFORRSP, 0, &offval); |
604 | mdelay(10); | 609 | mdelay(10); |
605 | 610 | ||
606 | res = count; | 611 | if (!res) |
612 | res = count; | ||
607 | out_unlock: | 613 | out_unlock: |
608 | free_page(addr); | 614 | free_page(addr); |
609 | return res; | 615 | return res; |
@@ -628,10 +634,12 @@ static ssize_t lbs_rdrf_read(struct file *file, char __user *userbuf, | |||
628 | CMD_RF_REG_ACCESS, 0, | 634 | CMD_RF_REG_ACCESS, 0, |
629 | CMD_OPTION_WAITFORRSP, 0, &offval); | 635 | CMD_OPTION_WAITFORRSP, 0, &offval); |
630 | mdelay(10); | 636 | mdelay(10); |
631 | pos += snprintf(buf+pos, len-pos, "RF[0x%x] = 0x%08x\n", | 637 | if (!ret) { |
638 | pos += snprintf(buf+pos, len-pos, "RF[0x%x] = 0x%08x\n", | ||
632 | priv->rf_offset, priv->offsetvalue.value); | 639 | priv->rf_offset, priv->offsetvalue.value); |
633 | 640 | ||
634 | ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); | 641 | ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); |
642 | } | ||
635 | free_page(addr); | 643 | free_page(addr); |
636 | 644 | ||
637 | return ret; | 645 | return ret; |
@@ -692,7 +700,8 @@ static ssize_t lbs_wrrf_write(struct file *file, | |||
692 | CMD_OPTION_WAITFORRSP, 0, &offval); | 700 | CMD_OPTION_WAITFORRSP, 0, &offval); |
693 | mdelay(10); | 701 | mdelay(10); |
694 | 702 | ||
695 | res = count; | 703 | if (!res) |
704 | res = count; | ||
696 | out_unlock: | 705 | out_unlock: |
697 | free_page(addr); | 706 | free_page(addr); |
698 | return res; | 707 | return res; |
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 87bfd17b9c8c..b7363236cc53 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -1089,6 +1089,8 @@ static void auto_deepsleep_timer_fn(unsigned long data) | |||
1089 | ret = lbs_prepare_and_send_command(priv, | 1089 | ret = lbs_prepare_and_send_command(priv, |
1090 | CMD_802_11_DEEP_SLEEP, 0, | 1090 | CMD_802_11_DEEP_SLEEP, 0, |
1091 | 0, 0, NULL); | 1091 | 0, 0, NULL); |
1092 | if (ret) | ||
1093 | lbs_pr_err("Enter Deep Sleep command failed\n"); | ||
1092 | } | 1094 | } |
1093 | } | 1095 | } |
1094 | mod_timer(&priv->auto_deepsleep_timer , jiffies + | 1096 | mod_timer(&priv->auto_deepsleep_timer , jiffies + |
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index 6c95af3023cc..d8fc2b8b3027 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c | |||
@@ -1022,9 +1022,12 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, | |||
1022 | return -EAGAIN; | 1022 | return -EAGAIN; |
1023 | 1023 | ||
1024 | /* Update RSSI if current BSS is a locally created ad-hoc BSS */ | 1024 | /* Update RSSI if current BSS is a locally created ad-hoc BSS */ |
1025 | if ((priv->mode == IW_MODE_ADHOC) && priv->adhoccreate) | 1025 | if ((priv->mode == IW_MODE_ADHOC) && priv->adhoccreate) { |
1026 | lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, | 1026 | err = lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, |
1027 | CMD_OPTION_WAITFORRSP, 0, NULL); | 1027 | CMD_OPTION_WAITFORRSP, 0, NULL); |
1028 | if (err) | ||
1029 | goto out; | ||
1030 | } | ||
1028 | 1031 | ||
1029 | mutex_lock(&priv->lock); | 1032 | mutex_lock(&priv->lock); |
1030 | list_for_each_entry_safe (iter_bss, safe, &priv->network_list, list) { | 1033 | list_for_each_entry_safe (iter_bss, safe, &priv->network_list, list) { |
@@ -1058,7 +1061,7 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, | |||
1058 | 1061 | ||
1059 | dwrq->length = (ev - extra); | 1062 | dwrq->length = (ev - extra); |
1060 | dwrq->flags = 0; | 1063 | dwrq->flags = 0; |
1061 | 1064 | out: | |
1062 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", err); | 1065 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", err); |
1063 | return err; | 1066 | return err; |
1064 | } | 1067 | } |
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 69dd19bf9558..4594841cd4af 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c | |||
@@ -832,7 +832,7 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev) | |||
832 | u32 rssi_qual; | 832 | u32 rssi_qual; |
833 | u32 tx_qual; | 833 | u32 tx_qual; |
834 | u32 quality = 0; | 834 | u32 quality = 0; |
835 | int stats_valid = 0; | 835 | int ret, stats_valid = 0; |
836 | u8 rssi; | 836 | u8 rssi; |
837 | u32 tx_retries; | 837 | u32 tx_retries; |
838 | struct cmd_ds_802_11_get_log log; | 838 | struct cmd_ds_802_11_get_log log; |
@@ -881,7 +881,9 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev) | |||
881 | 881 | ||
882 | memset(&log, 0, sizeof(log)); | 882 | memset(&log, 0, sizeof(log)); |
883 | log.hdr.size = cpu_to_le16(sizeof(log)); | 883 | log.hdr.size = cpu_to_le16(sizeof(log)); |
884 | lbs_cmd_with_response(priv, CMD_802_11_GET_LOG, &log); | 884 | ret = lbs_cmd_with_response(priv, CMD_802_11_GET_LOG, &log); |
885 | if (ret) | ||
886 | goto out; | ||
885 | 887 | ||
886 | tx_retries = le32_to_cpu(log.retry); | 888 | tx_retries = le32_to_cpu(log.retry); |
887 | 889 | ||
@@ -909,8 +911,10 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev) | |||
909 | stats_valid = 1; | 911 | stats_valid = 1; |
910 | 912 | ||
911 | /* update stats asynchronously for future calls */ | 913 | /* update stats asynchronously for future calls */ |
912 | lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, | 914 | ret = lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, |
913 | 0, 0, NULL); | 915 | 0, 0, NULL); |
916 | if (ret) | ||
917 | lbs_pr_err("RSSI command failed\n"); | ||
914 | out: | 918 | out: |
915 | if (!stats_valid) { | 919 | if (!stats_valid) { |
916 | priv->wstats.miss.beacon = 0; | 920 | priv->wstats.miss.beacon = 0; |