diff options
Diffstat (limited to 'drivers/net/wireless/mwifiex')
-rw-r--r-- | drivers/net/wireless/mwifiex/usb.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c index e6d796fabab5..22a5916564b8 100644 --- a/drivers/net/wireless/mwifiex/usb.c +++ b/drivers/net/wireless/mwifiex/usb.c | |||
@@ -49,6 +49,7 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, | |||
49 | struct device *dev = adapter->dev; | 49 | struct device *dev = adapter->dev; |
50 | u32 recv_type; | 50 | u32 recv_type; |
51 | __le32 tmp; | 51 | __le32 tmp; |
52 | int ret; | ||
52 | 53 | ||
53 | if (adapter->hs_activated) | 54 | if (adapter->hs_activated) |
54 | mwifiex_process_hs_config(adapter); | 55 | mwifiex_process_hs_config(adapter); |
@@ -69,16 +70,19 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, | |||
69 | case MWIFIEX_USB_TYPE_CMD: | 70 | case MWIFIEX_USB_TYPE_CMD: |
70 | if (skb->len > MWIFIEX_SIZE_OF_CMD_BUFFER) { | 71 | if (skb->len > MWIFIEX_SIZE_OF_CMD_BUFFER) { |
71 | dev_err(dev, "CMD: skb->len too large\n"); | 72 | dev_err(dev, "CMD: skb->len too large\n"); |
72 | return -1; | 73 | ret = -1; |
74 | goto exit_restore_skb; | ||
73 | } else if (!adapter->curr_cmd) { | 75 | } else if (!adapter->curr_cmd) { |
74 | dev_dbg(dev, "CMD: no curr_cmd\n"); | 76 | dev_dbg(dev, "CMD: no curr_cmd\n"); |
75 | if (adapter->ps_state == PS_STATE_SLEEP_CFM) { | 77 | if (adapter->ps_state == PS_STATE_SLEEP_CFM) { |
76 | mwifiex_process_sleep_confirm_resp( | 78 | mwifiex_process_sleep_confirm_resp( |
77 | adapter, skb->data, | 79 | adapter, skb->data, |
78 | skb->len); | 80 | skb->len); |
79 | return 0; | 81 | ret = 0; |
82 | goto exit_restore_skb; | ||
80 | } | 83 | } |
81 | return -1; | 84 | ret = -1; |
85 | goto exit_restore_skb; | ||
82 | } | 86 | } |
83 | 87 | ||
84 | adapter->curr_cmd->resp_skb = skb; | 88 | adapter->curr_cmd->resp_skb = skb; |
@@ -87,7 +91,8 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, | |||
87 | case MWIFIEX_USB_TYPE_EVENT: | 91 | case MWIFIEX_USB_TYPE_EVENT: |
88 | if (skb->len < sizeof(u32)) { | 92 | if (skb->len < sizeof(u32)) { |
89 | dev_err(dev, "EVENT: skb->len too small\n"); | 93 | dev_err(dev, "EVENT: skb->len too small\n"); |
90 | return -1; | 94 | ret = -1; |
95 | goto exit_restore_skb; | ||
91 | } | 96 | } |
92 | skb_copy_from_linear_data(skb, &tmp, sizeof(u32)); | 97 | skb_copy_from_linear_data(skb, &tmp, sizeof(u32)); |
93 | adapter->event_cause = le32_to_cpu(tmp); | 98 | adapter->event_cause = le32_to_cpu(tmp); |
@@ -95,7 +100,8 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, | |||
95 | 100 | ||
96 | if (skb->len > MAX_EVENT_SIZE) { | 101 | if (skb->len > MAX_EVENT_SIZE) { |
97 | dev_err(dev, "EVENT: event body too large\n"); | 102 | dev_err(dev, "EVENT: event body too large\n"); |
98 | return -1; | 103 | ret = -1; |
104 | goto exit_restore_skb; | ||
99 | } | 105 | } |
100 | 106 | ||
101 | memcpy(adapter->event_body, skb->data + | 107 | memcpy(adapter->event_body, skb->data + |
@@ -124,6 +130,12 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, | |||
124 | } | 130 | } |
125 | 131 | ||
126 | return -EINPROGRESS; | 132 | return -EINPROGRESS; |
133 | |||
134 | exit_restore_skb: | ||
135 | /* The buffer will be reused for further cmds/events */ | ||
136 | skb_push(skb, INTF_HEADER_LEN); | ||
137 | |||
138 | return ret; | ||
127 | } | 139 | } |
128 | 140 | ||
129 | static void mwifiex_usb_rx_complete(struct urb *urb) | 141 | static void mwifiex_usb_rx_complete(struct urb *urb) |