Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 311612
b: refs/heads/master
c: 8311f0d
h: refs/heads/master
v: v3
  • Loading branch information
Amitkumar Karwar authored and John W. Linville committed Jun 22, 2012
1 parent b03c698 commit 4cf8db1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e80c81dc1416e326482c601af3a19d0f9989638e
refs/heads/master: 8311f0da95d483ceb76bafae6e0a8c90531fb577
22 changes: 17 additions & 5 deletions trunk/drivers/net/wireless/mwifiex/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter,
struct device *dev = adapter->dev;
u32 recv_type;
__le32 tmp;
int ret;

if (adapter->hs_activated)
mwifiex_process_hs_config(adapter);
Expand All @@ -69,16 +70,19 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter,
case MWIFIEX_USB_TYPE_CMD:
if (skb->len > MWIFIEX_SIZE_OF_CMD_BUFFER) {
dev_err(dev, "CMD: skb->len too large\n");
return -1;
ret = -1;
goto exit_restore_skb;
} else if (!adapter->curr_cmd) {
dev_dbg(dev, "CMD: no curr_cmd\n");
if (adapter->ps_state == PS_STATE_SLEEP_CFM) {
mwifiex_process_sleep_confirm_resp(
adapter, skb->data,
skb->len);
return 0;
ret = 0;
goto exit_restore_skb;
}
return -1;
ret = -1;
goto exit_restore_skb;
}

adapter->curr_cmd->resp_skb = skb;
Expand All @@ -87,15 +91,17 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter,
case MWIFIEX_USB_TYPE_EVENT:
if (skb->len < sizeof(u32)) {
dev_err(dev, "EVENT: skb->len too small\n");
return -1;
ret = -1;
goto exit_restore_skb;
}
skb_copy_from_linear_data(skb, &tmp, sizeof(u32));
adapter->event_cause = le32_to_cpu(tmp);
dev_dbg(dev, "event_cause %#x\n", adapter->event_cause);

if (skb->len > MAX_EVENT_SIZE) {
dev_err(dev, "EVENT: event body too large\n");
return -1;
ret = -1;
goto exit_restore_skb;
}

memcpy(adapter->event_body, skb->data +
Expand Down Expand Up @@ -124,6 +130,12 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter,
}

return -EINPROGRESS;

exit_restore_skb:
/* The buffer will be reused for further cmds/events */
skb_push(skb, INTF_HEADER_LEN);

return ret;
}

static void mwifiex_usb_rx_complete(struct urb *urb)
Expand Down

0 comments on commit 4cf8db1

Please sign in to comment.