Commit 70567833 authored by David S. Miller's avatar David S. Miller

Merge branch 'net-urb-alloc-failure'

Wolfram Sang says:

====================
net: don't print error when allocating urb fails

This per-subsystem series is part of a tree wide cleanup. usb_alloc_urb() uses
kmalloc which already prints enough information on failure. So, let's simply
remove those "allocation failed" messages from drivers like we did already for
other -ENOMEM cases. gkh acked this approach when we talked about it at LCJ in
Tokyo a few weeks ago.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 6176e89c eb363338
...@@ -600,7 +600,6 @@ static int ems_usb_start(struct ems_usb *dev) ...@@ -600,7 +600,6 @@ static int ems_usb_start(struct ems_usb *dev)
/* create a URB, and a buffer for it */ /* create a URB, and a buffer for it */
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb) { if (!urb) {
netdev_err(netdev, "No memory left for URBs\n");
err = -ENOMEM; err = -ENOMEM;
break; break;
} }
...@@ -752,10 +751,8 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne ...@@ -752,10 +751,8 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
/* create a URB, and a buffer for it, and copy the data to the URB */ /* create a URB, and a buffer for it, and copy the data to the URB */
urb = usb_alloc_urb(0, GFP_ATOMIC); urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) { if (!urb)
netdev_err(netdev, "No memory left for URBs\n");
goto nomem; goto nomem;
}
buf = usb_alloc_coherent(dev->udev, size, GFP_ATOMIC, &urb->transfer_dma); buf = usb_alloc_coherent(dev->udev, size, GFP_ATOMIC, &urb->transfer_dma);
if (!buf) { if (!buf) {
...@@ -1007,10 +1004,8 @@ static int ems_usb_probe(struct usb_interface *intf, ...@@ -1007,10 +1004,8 @@ static int ems_usb_probe(struct usb_interface *intf,
dev->tx_contexts[i].echo_index = MAX_TX_URBS; dev->tx_contexts[i].echo_index = MAX_TX_URBS;
dev->intr_urb = usb_alloc_urb(0, GFP_KERNEL); dev->intr_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->intr_urb) { if (!dev->intr_urb)
dev_err(&intf->dev, "Couldn't alloc intr URB\n");
goto cleanup_candev; goto cleanup_candev;
}
dev->intr_in_buffer = kzalloc(INTR_IN_BUFFER_SIZE, GFP_KERNEL); dev->intr_in_buffer = kzalloc(INTR_IN_BUFFER_SIZE, GFP_KERNEL);
if (!dev->intr_in_buffer) if (!dev->intr_in_buffer)
......
...@@ -558,8 +558,6 @@ static int esd_usb2_setup_rx_urbs(struct esd_usb2 *dev) ...@@ -558,8 +558,6 @@ static int esd_usb2_setup_rx_urbs(struct esd_usb2 *dev)
/* create a URB, and a buffer for it */ /* create a URB, and a buffer for it */
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb) { if (!urb) {
dev_warn(dev->udev->dev.parent,
"No memory left for URBs\n");
err = -ENOMEM; err = -ENOMEM;
break; break;
} }
...@@ -730,7 +728,6 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb, ...@@ -730,7 +728,6 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb,
/* create a URB, and a buffer for it, and copy the data to the URB */ /* create a URB, and a buffer for it, and copy the data to the URB */
urb = usb_alloc_urb(0, GFP_ATOMIC); urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) { if (!urb) {
netdev_err(netdev, "No memory left for URBs\n");
stats->tx_dropped++; stats->tx_dropped++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
goto nourbmem; goto nourbmem;
......
...@@ -493,10 +493,8 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb, ...@@ -493,10 +493,8 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb,
/* create a URB, and a buffer for it */ /* create a URB, and a buffer for it */
urb = usb_alloc_urb(0, GFP_ATOMIC); urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) { if (!urb)
netdev_err(netdev, "No memory left for URB\n");
goto nomem_urb; goto nomem_urb;
}
hf = usb_alloc_coherent(dev->udev, sizeof(*hf), GFP_ATOMIC, hf = usb_alloc_coherent(dev->udev, sizeof(*hf), GFP_ATOMIC,
&urb->transfer_dma); &urb->transfer_dma);
...@@ -600,11 +598,8 @@ static int gs_can_open(struct net_device *netdev) ...@@ -600,11 +598,8 @@ static int gs_can_open(struct net_device *netdev)
/* alloc rx urb */ /* alloc rx urb */
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb) { if (!urb)
netdev_err(netdev,
"No memory left for URB\n");
return -ENOMEM; return -ENOMEM;
}
/* alloc rx buffer */ /* alloc rx buffer */
buf = usb_alloc_coherent(dev->udev, buf = usb_alloc_coherent(dev->udev,
......
...@@ -787,10 +787,8 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv, ...@@ -787,10 +787,8 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv,
int err; int err;
urb = usb_alloc_urb(0, GFP_ATOMIC); urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) { if (!urb)
netdev_err(netdev, "No memory left for URBs\n");
return -ENOMEM; return -ENOMEM;
}
buf = kmalloc(sizeof(struct kvaser_msg), GFP_ATOMIC); buf = kmalloc(sizeof(struct kvaser_msg), GFP_ATOMIC);
if (!buf) { if (!buf) {
...@@ -1393,8 +1391,6 @@ static int kvaser_usb_setup_rx_urbs(struct kvaser_usb *dev) ...@@ -1393,8 +1391,6 @@ static int kvaser_usb_setup_rx_urbs(struct kvaser_usb *dev)
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb) { if (!urb) {
dev_warn(dev->udev->dev.parent,
"No memory left for URBs\n");
err = -ENOMEM; err = -ENOMEM;
break; break;
} }
...@@ -1670,7 +1666,6 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, ...@@ -1670,7 +1666,6 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
urb = usb_alloc_urb(0, GFP_ATOMIC); urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) { if (!urb) {
netdev_err(netdev, "No memory left for URBs\n");
stats->tx_dropped++; stats->tx_dropped++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
return NETDEV_TX_OK; return NETDEV_TX_OK;
......
...@@ -399,7 +399,6 @@ static int peak_usb_start(struct peak_usb_device *dev) ...@@ -399,7 +399,6 @@ static int peak_usb_start(struct peak_usb_device *dev)
/* create a URB, and a buffer for it, to receive usb messages */ /* create a URB, and a buffer for it, to receive usb messages */
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb) { if (!urb) {
netdev_err(netdev, "No memory left for URBs\n");
err = -ENOMEM; err = -ENOMEM;
break; break;
} }
...@@ -454,7 +453,6 @@ static int peak_usb_start(struct peak_usb_device *dev) ...@@ -454,7 +453,6 @@ static int peak_usb_start(struct peak_usb_device *dev)
/* create a URB and a buffer for it, to transmit usb messages */ /* create a URB and a buffer for it, to transmit usb messages */
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb) { if (!urb) {
netdev_err(netdev, "No memory left for URBs\n");
err = -ENOMEM; err = -ENOMEM;
break; break;
} }
...@@ -651,10 +649,8 @@ static int peak_usb_restart(struct peak_usb_device *dev) ...@@ -651,10 +649,8 @@ static int peak_usb_restart(struct peak_usb_device *dev)
/* first allocate a urb to handle the asynchronous steps */ /* first allocate a urb to handle the asynchronous steps */
urb = usb_alloc_urb(0, GFP_ATOMIC); urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) { if (!urb)
netdev_err(dev->netdev, "no memory left for urb\n");
return -ENOMEM; return -ENOMEM;
}
/* also allocate enough space for the commands to send */ /* also allocate enough space for the commands to send */
buf = kmalloc(PCAN_USB_MAX_CMD_LEN, GFP_ATOMIC); buf = kmalloc(PCAN_USB_MAX_CMD_LEN, GFP_ATOMIC);
......
...@@ -623,10 +623,8 @@ static netdev_tx_t usb_8dev_start_xmit(struct sk_buff *skb, ...@@ -623,10 +623,8 @@ static netdev_tx_t usb_8dev_start_xmit(struct sk_buff *skb,
/* create a URB, and a buffer for it, and copy the data to the URB */ /* create a URB, and a buffer for it, and copy the data to the URB */
urb = usb_alloc_urb(0, GFP_ATOMIC); urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) { if (!urb)
netdev_err(netdev, "No memory left for URBs\n");
goto nomem; goto nomem;
}
buf = usb_alloc_coherent(priv->udev, size, GFP_ATOMIC, buf = usb_alloc_coherent(priv->udev, size, GFP_ATOMIC,
&urb->transfer_dma); &urb->transfer_dma);
...@@ -748,7 +746,6 @@ static int usb_8dev_start(struct usb_8dev_priv *priv) ...@@ -748,7 +746,6 @@ static int usb_8dev_start(struct usb_8dev_priv *priv)
/* create a URB, and a buffer for it */ /* create a URB, and a buffer for it */
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb) { if (!urb) {
netdev_err(netdev, "No memory left for URBs\n");
err = -ENOMEM; err = -ENOMEM;
break; break;
} }
......
...@@ -2300,10 +2300,8 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs, ...@@ -2300,10 +2300,8 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
serial->rx_data_length = rx_size; serial->rx_data_length = rx_size;
for (i = 0; i < serial->num_rx_urbs; i++) { for (i = 0; i < serial->num_rx_urbs; i++) {
serial->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL); serial->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
if (!serial->rx_urb[i]) { if (!serial->rx_urb[i])
dev_err(dev, "Could not allocate urb?\n");
goto exit; goto exit;
}
serial->rx_urb[i]->transfer_buffer = NULL; serial->rx_urb[i]->transfer_buffer = NULL;
serial->rx_urb[i]->transfer_buffer_length = 0; serial->rx_urb[i]->transfer_buffer_length = 0;
serial->rx_data[i] = kzalloc(serial->rx_data_length, serial->rx_data[i] = kzalloc(serial->rx_data_length,
...@@ -2314,10 +2312,8 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs, ...@@ -2314,10 +2312,8 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
/* TX, allocate urb and initialize */ /* TX, allocate urb and initialize */
serial->tx_urb = usb_alloc_urb(0, GFP_KERNEL); serial->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!serial->tx_urb) { if (!serial->tx_urb)
dev_err(dev, "Could not allocate urb?\n");
goto exit; goto exit;
}
serial->tx_urb->transfer_buffer = NULL; serial->tx_urb->transfer_buffer = NULL;
serial->tx_urb->transfer_buffer_length = 0; serial->tx_urb->transfer_buffer_length = 0;
/* prepare our TX buffer */ /* prepare our TX buffer */
...@@ -2555,20 +2551,16 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface, ...@@ -2555,20 +2551,16 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface,
/* start allocating */ /* start allocating */
for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) { for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) {
hso_net->mux_bulk_rx_urb_pool[i] = usb_alloc_urb(0, GFP_KERNEL); hso_net->mux_bulk_rx_urb_pool[i] = usb_alloc_urb(0, GFP_KERNEL);
if (!hso_net->mux_bulk_rx_urb_pool[i]) { if (!hso_net->mux_bulk_rx_urb_pool[i])
dev_err(&interface->dev, "Could not allocate rx urb\n");
goto exit; goto exit;
}
hso_net->mux_bulk_rx_buf_pool[i] = kzalloc(MUX_BULK_RX_BUF_SIZE, hso_net->mux_bulk_rx_buf_pool[i] = kzalloc(MUX_BULK_RX_BUF_SIZE,
GFP_KERNEL); GFP_KERNEL);
if (!hso_net->mux_bulk_rx_buf_pool[i]) if (!hso_net->mux_bulk_rx_buf_pool[i])
goto exit; goto exit;
} }
hso_net->mux_bulk_tx_urb = usb_alloc_urb(0, GFP_KERNEL); hso_net->mux_bulk_tx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!hso_net->mux_bulk_tx_urb) { if (!hso_net->mux_bulk_tx_urb)
dev_err(&interface->dev, "Could not allocate tx urb\n");
goto exit; goto exit;
}
hso_net->mux_bulk_tx_buf = kzalloc(MUX_BULK_TX_BUF_SIZE, GFP_KERNEL); hso_net->mux_bulk_tx_buf = kzalloc(MUX_BULK_TX_BUF_SIZE, GFP_KERNEL);
if (!hso_net->mux_bulk_tx_buf) if (!hso_net->mux_bulk_tx_buf)
goto exit; goto exit;
...@@ -2787,10 +2779,8 @@ struct hso_shared_int *hso_create_shared_int(struct usb_interface *interface) ...@@ -2787,10 +2779,8 @@ struct hso_shared_int *hso_create_shared_int(struct usb_interface *interface)
} }
mux->shared_intr_urb = usb_alloc_urb(0, GFP_KERNEL); mux->shared_intr_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!mux->shared_intr_urb) { if (!mux->shared_intr_urb)
dev_err(&interface->dev, "Could not allocate intr urb?\n");
goto exit; goto exit;
}
mux->shared_intr_buf = mux->shared_intr_buf =
kzalloc(le16_to_cpu(mux->intr_endp->wMaxPacketSize), kzalloc(le16_to_cpu(mux->intr_endp->wMaxPacketSize),
GFP_KERNEL); GFP_KERNEL);
......
...@@ -3002,10 +3002,8 @@ static void lan78xx_tx_bh(struct lan78xx_net *dev) ...@@ -3002,10 +3002,8 @@ static void lan78xx_tx_bh(struct lan78xx_net *dev)
gso_skb: gso_skb:
urb = usb_alloc_urb(0, GFP_ATOMIC); urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) { if (!urb)
netif_dbg(dev, tx_err, dev->net, "no urb\n");
goto drop; goto drop;
}
entry = (struct skb_data *)skb->cb; entry = (struct skb_data *)skb->cb;
entry->urb = urb; entry->urb = urb;
......
...@@ -2062,11 +2062,8 @@ int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype, ...@@ -2062,11 +2062,8 @@ int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype,
cmd, reqtype, value, index, size); cmd, reqtype, value, index, size);
urb = usb_alloc_urb(0, GFP_ATOMIC); urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) { if (!urb)
netdev_err(dev->net, "Error allocating URB in"
" %s!\n", __func__);
goto fail; goto fail;
}
if (data) { if (data) {
buf = kmemdup(data, size, GFP_ATOMIC); buf = kmemdup(data, size, GFP_ATOMIC);
......
...@@ -206,7 +206,6 @@ int i2400mu_notification_setup(struct i2400mu *i2400mu) ...@@ -206,7 +206,6 @@ int i2400mu_notification_setup(struct i2400mu *i2400mu)
i2400mu->notif_urb = usb_alloc_urb(0, GFP_KERNEL); i2400mu->notif_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!i2400mu->notif_urb) { if (!i2400mu->notif_urb) {
ret = -ENOMEM; ret = -ENOMEM;
dev_err(dev, "notification: cannot allocate URB\n");
goto error_alloc_urb; goto error_alloc_urb;
} }
epd = usb_get_epd(i2400mu->usb_iface, epd = usb_get_epd(i2400mu->usb_iface,
......
...@@ -706,10 +706,8 @@ static int ar5523_alloc_rx_bufs(struct ar5523 *ar) ...@@ -706,10 +706,8 @@ static int ar5523_alloc_rx_bufs(struct ar5523 *ar)
data->ar = ar; data->ar = ar;
data->urb = usb_alloc_urb(0, GFP_KERNEL); data->urb = usb_alloc_urb(0, GFP_KERNEL);
if (!data->urb) { if (!data->urb)
ar5523_err(ar, "could not allocate rx data urb\n");
goto err; goto err;
}
list_add_tail(&data->list, &ar->rx_data_free); list_add_tail(&data->list, &ar->rx_data_free);
atomic_inc(&ar->rx_data_free_cnt); atomic_inc(&ar->rx_data_free_cnt);
} }
...@@ -824,7 +822,6 @@ static void ar5523_tx_work_locked(struct ar5523 *ar) ...@@ -824,7 +822,6 @@ static void ar5523_tx_work_locked(struct ar5523 *ar)
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb) { if (!urb) {
ar5523_err(ar, "Failed to allocate TX urb\n");
ieee80211_free_txskb(ar->hw, skb); ieee80211_free_txskb(ar->hw, skb);
continue; continue;
} }
...@@ -949,10 +946,8 @@ static int ar5523_alloc_tx_cmd(struct ar5523 *ar) ...@@ -949,10 +946,8 @@ static int ar5523_alloc_tx_cmd(struct ar5523 *ar)
init_completion(&cmd->done); init_completion(&cmd->done);
cmd->urb_tx = usb_alloc_urb(0, GFP_KERNEL); cmd->urb_tx = usb_alloc_urb(0, GFP_KERNEL);
if (!cmd->urb_tx) { if (!cmd->urb_tx)
ar5523_err(ar, "could not allocate urb\n");
return -ENOMEM; return -ENOMEM;
}
cmd->buf_tx = usb_alloc_coherent(ar->dev, AR5523_MAX_TXCMDSZ, cmd->buf_tx = usb_alloc_coherent(ar->dev, AR5523_MAX_TXCMDSZ,
GFP_KERNEL, GFP_KERNEL,
&cmd->urb_tx->transfer_dma); &cmd->urb_tx->transfer_dma);
......
...@@ -1099,15 +1099,11 @@ struct brcmf_usbdev *brcmf_usb_attach(struct brcmf_usbdev_info *devinfo, ...@@ -1099,15 +1099,11 @@ struct brcmf_usbdev *brcmf_usb_attach(struct brcmf_usbdev_info *devinfo,
devinfo->tx_freecount = ntxq; devinfo->tx_freecount = ntxq;
devinfo->ctl_urb = usb_alloc_urb(0, GFP_ATOMIC); devinfo->ctl_urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!devinfo->ctl_urb) { if (!devinfo->ctl_urb)
brcmf_err("usb_alloc_urb (ctl) failed\n");
goto error; goto error;
}
devinfo->bulk_urb = usb_alloc_urb(0, GFP_ATOMIC); devinfo->bulk_urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!devinfo->bulk_urb) { if (!devinfo->bulk_urb)
brcmf_err("usb_alloc_urb (bulk) failed\n");
goto error; goto error;
}
return &devinfo->bus_pub; return &devinfo->bus_pub;
......
...@@ -1613,10 +1613,8 @@ static int ezusb_probe(struct usb_interface *interface, ...@@ -1613,10 +1613,8 @@ static int ezusb_probe(struct usb_interface *interface,
} }
upriv->read_urb = usb_alloc_urb(0, GFP_KERNEL); upriv->read_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!upriv->read_urb) { if (!upriv->read_urb)
err("No free urbs available");
goto error; goto error;
}
if (le16_to_cpu(ep->wMaxPacketSize) != 64) if (le16_to_cpu(ep->wMaxPacketSize) != 64)
pr_warn("bulk in: wMaxPacketSize!= 64\n"); pr_warn("bulk in: wMaxPacketSize!= 64\n");
if (ep->bEndpointAddress != (2 | USB_DIR_IN)) if (ep->bEndpointAddress != (2 | USB_DIR_IN))
......
...@@ -198,22 +198,16 @@ static int if_usb_probe(struct usb_interface *intf, ...@@ -198,22 +198,16 @@ static int if_usb_probe(struct usb_interface *intf,
} }
cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL); cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!cardp->rx_urb) { if (!cardp->rx_urb)
lbtf_deb_usbd(&udev->dev, "Rx URB allocation failed\n");
goto dealloc; goto dealloc;
}
cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL); cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!cardp->tx_urb) { if (!cardp->tx_urb)
lbtf_deb_usbd(&udev->dev, "Tx URB allocation failed\n");
goto dealloc; goto dealloc;
}
cardp->cmd_urb = usb_alloc_urb(0, GFP_KERNEL); cardp->cmd_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!cardp->cmd_urb) { if (!cardp->cmd_urb)
lbtf_deb_usbd(&udev->dev, "Cmd URB allocation failed\n");
goto dealloc; goto dealloc;
}
cardp->ep_out_buf = kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE, cardp->ep_out_buf = kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE,
GFP_KERNEL); GFP_KERNEL);
......
...@@ -657,11 +657,8 @@ static int mwifiex_usb_tx_init(struct mwifiex_adapter *adapter) ...@@ -657,11 +657,8 @@ static int mwifiex_usb_tx_init(struct mwifiex_adapter *adapter)
card->tx_cmd.ep = card->tx_cmd_ep; card->tx_cmd.ep = card->tx_cmd_ep;
card->tx_cmd.urb = usb_alloc_urb(0, GFP_KERNEL); card->tx_cmd.urb = usb_alloc_urb(0, GFP_KERNEL);
if (!card->tx_cmd.urb) { if (!card->tx_cmd.urb)
mwifiex_dbg(adapter, ERROR,
"tx_cmd.urb allocation failed\n");
return -ENOMEM; return -ENOMEM;
}
for (i = 0; i < MWIFIEX_TX_DATA_PORT; i++) { for (i = 0; i < MWIFIEX_TX_DATA_PORT; i++) {
port = &card->port[i]; port = &card->port[i];
...@@ -677,11 +674,8 @@ static int mwifiex_usb_tx_init(struct mwifiex_adapter *adapter) ...@@ -677,11 +674,8 @@ static int mwifiex_usb_tx_init(struct mwifiex_adapter *adapter)
port->tx_data_list[j].ep = port->tx_data_ep; port->tx_data_list[j].ep = port->tx_data_ep;
port->tx_data_list[j].urb = port->tx_data_list[j].urb =
usb_alloc_urb(0, GFP_KERNEL); usb_alloc_urb(0, GFP_KERNEL);
if (!port->tx_data_list[j].urb) { if (!port->tx_data_list[j].urb)
mwifiex_dbg(adapter, ERROR,
"urb allocation failed\n");
return -ENOMEM; return -ENOMEM;
}
} }
} }
...@@ -697,10 +691,8 @@ static int mwifiex_usb_rx_init(struct mwifiex_adapter *adapter) ...@@ -697,10 +691,8 @@ static int mwifiex_usb_rx_init(struct mwifiex_adapter *adapter)
card->rx_cmd.ep = card->rx_cmd_ep; card->rx_cmd.ep = card->rx_cmd_ep;
card->rx_cmd.urb = usb_alloc_urb(0, GFP_KERNEL); card->rx_cmd.urb = usb_alloc_urb(0, GFP_KERNEL);
if (!card->rx_cmd.urb) { if (!card->rx_cmd.urb)
mwifiex_dbg(adapter, ERROR, "rx_cmd.urb allocation failed\n");
return -ENOMEM; return -ENOMEM;
}
card->rx_cmd.skb = dev_alloc_skb(MWIFIEX_RX_CMD_BUF_SIZE); card->rx_cmd.skb = dev_alloc_skb(MWIFIEX_RX_CMD_BUF_SIZE);
if (!card->rx_cmd.skb) if (!card->rx_cmd.skb)
...@@ -714,11 +706,8 @@ static int mwifiex_usb_rx_init(struct mwifiex_adapter *adapter) ...@@ -714,11 +706,8 @@ static int mwifiex_usb_rx_init(struct mwifiex_adapter *adapter)
card->rx_data_list[i].ep = card->rx_data_ep; card->rx_data_list[i].ep = card->rx_data_ep;
card->rx_data_list[i].urb = usb_alloc_urb(0, GFP_KERNEL); card->rx_data_list[i].urb = usb_alloc_urb(0, GFP_KERNEL);
if (!card->rx_data_list[i].urb) { if (!card->rx_data_list[i].urb)
mwifiex_dbg(adapter, ERROR,
"rx_data_list[] urb allocation failed\n");
return -1; return -1;
}
if (mwifiex_usb_submit_rx_urb(&card->rx_data_list[i], if (mwifiex_usb_submit_rx_urb(&card->rx_data_list[i],
MWIFIEX_RX_DATA_BUF_SIZE)) MWIFIEX_RX_DATA_BUF_SIZE))
return -1; return -1;
......
...@@ -739,11 +739,8 @@ static int _rtl_usb_receive(struct ieee80211_hw *hw) ...@@ -739,11 +739,8 @@ static int _rtl_usb_receive(struct ieee80211_hw *hw)
for (i = 0; i < rtlusb->rx_urb_num; i++) { for (i = 0; i < rtlusb->rx_urb_num; i++) {
err = -ENOMEM; err = -ENOMEM;
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb) { if (!urb)
RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
"Failed to alloc URB!!\n");
goto err_out; goto err_out;
}
err = _rtl_prep_rx_urb(hw, rtlusb, urb, GFP_KERNEL); err = _rtl_prep_rx_urb(hw, rtlusb, urb, GFP_KERNEL);
if (err < 0) { if (err < 0) {
...@@ -907,15 +904,12 @@ static void _rtl_tx_complete(struct urb *urb) ...@@ -907,15 +904,12 @@ static void _rtl_tx_complete(struct urb *urb)
static struct urb *_rtl_usb_tx_urb_setup(struct ieee80211_hw *hw, static struct urb *_rtl_usb_tx_urb_setup(struct ieee80211_hw *hw,
struct sk_buff *skb, u32 ep_num) struct sk_buff *skb, u32 ep_num)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw));
struct urb *_urb; struct urb *_urb;
WARN_ON(NULL == skb); WARN_ON(NULL == skb);
_urb = usb_alloc_urb(0, GFP_ATOMIC); _urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!_urb) { if (!_urb) {
RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
"Can't allocate URB for bulk out!\n");
kfree_skb(skb); kfree_skb(skb);
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment