aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-08-03 09:40:55 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:50:17 -0400
commit8362cd413e8116306fafbaf414f0419db0595142 (patch)
treedad2dc7fe6988d6733eaf2f1f454bf6068133448 /drivers/net/wireless
parentc7fdf26995d5d6ebf1c3314ad001b9a4983c3f04 (diff)
[PATCH] libertas: fix sparse-reported problems
A few fields being converted to the wrong sized type, and a few missed endian conversions. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/libertas/11d.c2
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c4
-rw-r--r--drivers/net/wireless/libertas/debugfs.c2
-rw-r--r--drivers/net/wireless/libertas/if_usb.c30
-rw-r--r--drivers/net/wireless/libertas/rx.c4
-rw-r--r--drivers/net/wireless/libertas/wext.c8
6 files changed, 23 insertions, 27 deletions
diff --git a/drivers/net/wireless/libertas/11d.c b/drivers/net/wireless/libertas/11d.c
index 8b366ef2fe95..9cf0211de67f 100644
--- a/drivers/net/wireless/libertas/11d.c
+++ b/drivers/net/wireless/libertas/11d.c
@@ -543,7 +543,7 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
543 nr_subband * sizeof(struct ieeetypes_subbandset)); 543 nr_subband * sizeof(struct ieeetypes_subbandset));
544 544
545 cmd->size = cpu_to_le16(sizeof(pdomaininfo->action) + 545 cmd->size = cpu_to_le16(sizeof(pdomaininfo->action) +
546 domain->header.len + 546 le16_to_cpu(domain->header.len) +
547 sizeof(struct mrvlietypesheader) + 547 sizeof(struct mrvlietypesheader) +
548 S_DS_GEN); 548 S_DS_GEN);
549 } else { 549 } else {
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index c43b2725e5bc..4c36e63ae7b0 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -812,8 +812,8 @@ int libertas_process_rx_command(wlan_private * priv)
812 812
813 if (adapter->cur_cmd->cmdflags & CMD_F_HOSTCMD) { 813 if (adapter->cur_cmd->cmdflags & CMD_F_HOSTCMD) {
814 /* Copy the response back to response buffer */ 814 /* Copy the response back to response buffer */
815 memcpy(adapter->cur_cmd->pdata_buf, resp, resp->size); 815 memcpy(adapter->cur_cmd->pdata_buf, resp,
816 816 le16_to_cpu(resp->size));
817 adapter->cur_cmd->cmdflags &= ~CMD_F_HOSTCMD; 817 adapter->cur_cmd->cmdflags &= ~CMD_F_HOSTCMD;
818 } 818 }
819 819
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index 63e747ac49d0..6d95148e8725 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -510,7 +510,7 @@ static u16 libertas_get_events_bitmap(wlan_private *priv)
510 return 0; 510 return 0;
511 } 511 }
512 512
513 if (pcmdptr->command != CMD_RET(CMD_802_11_SUBSCRIBE_EVENT)) { 513 if (le16_to_cpu(pcmdptr->command) != CMD_RET(CMD_802_11_SUBSCRIBE_EVENT)) {
514 lbs_pr_err("command response incorrect!\n"); 514 lbs_pr_err("command response incorrect!\n");
515 kfree(response_buf); 515 kfree(response_buf);
516 return 0; 516 return 0;
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 53d479688ff9..364eae374b93 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -639,11 +639,13 @@ static void if_usb_receive(struct urb *urb)
639 639
640 int recvlength = urb->actual_length; 640 int recvlength = urb->actual_length;
641 u8 *recvbuff = NULL; 641 u8 *recvbuff = NULL;
642 u32 recvtype; 642 u32 recvtype = 0;
643 643
644 lbs_deb_enter(LBS_DEB_USB); 644 lbs_deb_enter(LBS_DEB_USB);
645 645
646 if (recvlength) { 646 if (recvlength) {
647 __le32 tmp;
648
647 if (urb->status) { 649 if (urb->status) {
648 lbs_deb_usbd(&cardp->udev->dev, 650 lbs_deb_usbd(&cardp->udev->dev,
649 "URB status is failed\n"); 651 "URB status is failed\n");
@@ -652,18 +654,14 @@ static void if_usb_receive(struct urb *urb)
652 } 654 }
653 655
654 recvbuff = skb->data + IPFIELD_ALIGN_OFFSET; 656 recvbuff = skb->data + IPFIELD_ALIGN_OFFSET;
655 memcpy(&recvtype, recvbuff, sizeof(u32)); 657 memcpy(&tmp, recvbuff, sizeof(u32));
656 lbs_deb_usbd(&cardp->udev->dev, 658 recvtype = le32_to_cpu(tmp);
657 "Recv length = 0x%x\n", recvlength);
658 lbs_deb_usbd(&cardp->udev->dev, 659 lbs_deb_usbd(&cardp->udev->dev,
659 "Receive type = 0x%X\n", recvtype); 660 "Recv length = 0x%x, Recv type = 0x%X\n",
660 recvtype = le32_to_cpu(recvtype); 661 recvlength, recvtype);
661 lbs_deb_usbd(&cardp->udev->dev,
662 "Receive type after = 0x%X\n", recvtype);
663 } else if (urb->status) 662 } else if (urb->status)
664 goto rx_exit; 663 goto rx_exit;
665 664
666
667 switch (recvtype) { 665 switch (recvtype) {
668 case CMD_TYPE_DATA: 666 case CMD_TYPE_DATA:
669 process_cmdtypedata(recvlength, skb, cardp, priv); 667 process_cmdtypedata(recvlength, skb, cardp, priv);
@@ -691,6 +689,8 @@ static void if_usb_receive(struct urb *urb)
691 spin_unlock(&priv->adapter->driver_lock); 689 spin_unlock(&priv->adapter->driver_lock);
692 goto rx_exit; 690 goto rx_exit;
693 default: 691 default:
692 lbs_deb_usbd(&cardp->udev->dev, "Unknown command type 0x%X\n",
693 recvtype);
694 kfree_skb(skb); 694 kfree_skb(skb);
695 break; 695 break;
696 } 696 }
@@ -711,21 +711,19 @@ rx_exit:
711 */ 711 */
712static int if_usb_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb) 712static int if_usb_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb)
713{ 713{
714 int ret = -1;
715 u32 tmp;
716 struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card; 714 struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card;
717 715
718 lbs_deb_usbd(&cardp->udev->dev,"*** type = %u\n", type); 716 lbs_deb_usbd(&cardp->udev->dev,"*** type = %u\n", type);
719 lbs_deb_usbd(&cardp->udev->dev,"size after = %d\n", nb); 717 lbs_deb_usbd(&cardp->udev->dev,"size after = %d\n", nb);
720 718
721 if (type == MVMS_CMD) { 719 if (type == MVMS_CMD) {
722 tmp = cpu_to_le32(CMD_TYPE_REQUEST); 720 __le32 tmp = cpu_to_le32(CMD_TYPE_REQUEST);
723 priv->dnld_sent = DNLD_CMD_SENT; 721 priv->dnld_sent = DNLD_CMD_SENT;
724 memcpy(cardp->bulk_out_buffer, (u8 *) & tmp, 722 memcpy(cardp->bulk_out_buffer, (u8 *) & tmp,
725 MESSAGE_HEADER_LEN); 723 MESSAGE_HEADER_LEN);
726 724
727 } else { 725 } else {
728 tmp = cpu_to_le32(CMD_TYPE_DATA); 726 __le32 tmp = cpu_to_le32(CMD_TYPE_DATA);
729 priv->dnld_sent = DNLD_DATA_SENT; 727 priv->dnld_sent = DNLD_DATA_SENT;
730 memcpy(cardp->bulk_out_buffer, (u8 *) & tmp, 728 memcpy(cardp->bulk_out_buffer, (u8 *) & tmp,
731 MESSAGE_HEADER_LEN); 729 MESSAGE_HEADER_LEN);
@@ -733,10 +731,8 @@ static int if_usb_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 n
733 731
734 memcpy((cardp->bulk_out_buffer + MESSAGE_HEADER_LEN), payload, nb); 732 memcpy((cardp->bulk_out_buffer + MESSAGE_HEADER_LEN), payload, nb);
735 733
736 ret = 734 return usb_tx_block(priv, cardp->bulk_out_buffer,
737 usb_tx_block(priv, cardp->bulk_out_buffer, nb + MESSAGE_HEADER_LEN); 735 nb + MESSAGE_HEADER_LEN);
738
739 return ret;
740} 736}
741 737
742/* called with adapter->driver_lock held */ 738/* called with adapter->driver_lock held */
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c
index 09def943b910..0420e5b9ff9b 100644
--- a/drivers/net/wireless/libertas/rx.c
+++ b/drivers/net/wireless/libertas/rx.c
@@ -370,8 +370,8 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
370 radiotap_hdr.hdr.it_version = 0; 370 radiotap_hdr.hdr.it_version = 0;
371 /* XXX must check this value for pad */ 371 /* XXX must check this value for pad */
372 radiotap_hdr.hdr.it_pad = 0; 372 radiotap_hdr.hdr.it_pad = 0;
373 radiotap_hdr.hdr.it_len = sizeof(struct rx_radiotap_hdr); 373 radiotap_hdr.hdr.it_len = cpu_to_le16 (sizeof(struct rx_radiotap_hdr));
374 radiotap_hdr.hdr.it_present = RX_RADIOTAP_PRESENT; 374 radiotap_hdr.hdr.it_present = cpu_to_le32 (RX_RADIOTAP_PRESENT);
375 /* unknown values */ 375 /* unknown values */
376 radiotap_hdr.flags = 0; 376 radiotap_hdr.flags = 0;
377 radiotap_hdr.chan_freq = 0; 377 radiotap_hdr.chan_freq = 0;
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 15395bf0a2ac..3f628223bc6c 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -872,7 +872,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
872 /* Quality by TX errors */ 872 /* Quality by TX errors */
873 priv->wstats.discard.retries = priv->stats.tx_errors; 873 priv->wstats.discard.retries = priv->stats.tx_errors;
874 874
875 tx_retries = le16_to_cpu(adapter->logmsg.retry); 875 tx_retries = le32_to_cpu(adapter->logmsg.retry);
876 876
877 if (tx_retries > 75) 877 if (tx_retries > 75)
878 tx_qual = (90 - tx_retries) * POOR / 15; 878 tx_qual = (90 - tx_retries) * POOR / 15;
@@ -888,10 +888,10 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
888 (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; 888 (PERFECT - VERY_GOOD) / 50 + VERY_GOOD;
889 quality = min(quality, tx_qual); 889 quality = min(quality, tx_qual);
890 890
891 priv->wstats.discard.code = le16_to_cpu(adapter->logmsg.wepundecryptable); 891 priv->wstats.discard.code = le32_to_cpu(adapter->logmsg.wepundecryptable);
892 priv->wstats.discard.fragment = le16_to_cpu(adapter->logmsg.rxfrag); 892 priv->wstats.discard.fragment = le32_to_cpu(adapter->logmsg.rxfrag);
893 priv->wstats.discard.retries = tx_retries; 893 priv->wstats.discard.retries = tx_retries;
894 priv->wstats.discard.misc = le16_to_cpu(adapter->logmsg.ackfailure); 894 priv->wstats.discard.misc = le32_to_cpu(adapter->logmsg.ackfailure);
895 895
896 /* Calculate quality */ 896 /* Calculate quality */
897 priv->wstats.qual.qual = min_t(u8, quality, 100); 897 priv->wstats.qual.qual = min_t(u8, quality, 100);