mirror of https://gitee.com/openkylin/linux.git
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: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
70567833ad
|
@ -600,7 +600,6 @@ static int ems_usb_start(struct ems_usb *dev)
|
|||
/* create a URB, and a buffer for it */
|
||||
urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!urb) {
|
||||
netdev_err(netdev, "No memory left for URBs\n");
|
||||
err = -ENOMEM;
|
||||
break;
|
||||
}
|
||||
|
@ -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 */
|
||||
urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
if (!urb) {
|
||||
netdev_err(netdev, "No memory left for URBs\n");
|
||||
if (!urb)
|
||||
goto nomem;
|
||||
}
|
||||
|
||||
buf = usb_alloc_coherent(dev->udev, size, GFP_ATOMIC, &urb->transfer_dma);
|
||||
if (!buf) {
|
||||
|
@ -1007,10 +1004,8 @@ static int ems_usb_probe(struct usb_interface *intf,
|
|||
dev->tx_contexts[i].echo_index = MAX_TX_URBS;
|
||||
|
||||
dev->intr_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!dev->intr_urb) {
|
||||
dev_err(&intf->dev, "Couldn't alloc intr URB\n");
|
||||
if (!dev->intr_urb)
|
||||
goto cleanup_candev;
|
||||
}
|
||||
|
||||
dev->intr_in_buffer = kzalloc(INTR_IN_BUFFER_SIZE, GFP_KERNEL);
|
||||
if (!dev->intr_in_buffer)
|
||||
|
|
|
@ -558,8 +558,6 @@ static int esd_usb2_setup_rx_urbs(struct esd_usb2 *dev)
|
|||
/* create a URB, and a buffer for it */
|
||||
urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!urb) {
|
||||
dev_warn(dev->udev->dev.parent,
|
||||
"No memory left for URBs\n");
|
||||
err = -ENOMEM;
|
||||
break;
|
||||
}
|
||||
|
@ -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 */
|
||||
urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
if (!urb) {
|
||||
netdev_err(netdev, "No memory left for URBs\n");
|
||||
stats->tx_dropped++;
|
||||
dev_kfree_skb(skb);
|
||||
goto nourbmem;
|
||||
|
|
|
@ -493,10 +493,8 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb,
|
|||
|
||||
/* create a URB, and a buffer for it */
|
||||
urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
if (!urb) {
|
||||
netdev_err(netdev, "No memory left for URB\n");
|
||||
if (!urb)
|
||||
goto nomem_urb;
|
||||
}
|
||||
|
||||
hf = usb_alloc_coherent(dev->udev, sizeof(*hf), GFP_ATOMIC,
|
||||
&urb->transfer_dma);
|
||||
|
@ -600,11 +598,8 @@ static int gs_can_open(struct net_device *netdev)
|
|||
|
||||
/* alloc rx urb */
|
||||
urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!urb) {
|
||||
netdev_err(netdev,
|
||||
"No memory left for URB\n");
|
||||
if (!urb)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* alloc rx buffer */
|
||||
buf = usb_alloc_coherent(dev->udev,
|
||||
|
|
|
@ -787,10 +787,8 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv,
|
|||
int err;
|
||||
|
||||
urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
if (!urb) {
|
||||
netdev_err(netdev, "No memory left for URBs\n");
|
||||
if (!urb)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
buf = kmalloc(sizeof(struct kvaser_msg), GFP_ATOMIC);
|
||||
if (!buf) {
|
||||
|
@ -1393,8 +1391,6 @@ static int kvaser_usb_setup_rx_urbs(struct kvaser_usb *dev)
|
|||
|
||||
urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!urb) {
|
||||
dev_warn(dev->udev->dev.parent,
|
||||
"No memory left for URBs\n");
|
||||
err = -ENOMEM;
|
||||
break;
|
||||
}
|
||||
|
@ -1670,7 +1666,6 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
|
|||
|
||||
urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
if (!urb) {
|
||||
netdev_err(netdev, "No memory left for URBs\n");
|
||||
stats->tx_dropped++;
|
||||
dev_kfree_skb(skb);
|
||||
return NETDEV_TX_OK;
|
||||
|
|
|
@ -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 */
|
||||
urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!urb) {
|
||||
netdev_err(netdev, "No memory left for URBs\n");
|
||||
err = -ENOMEM;
|
||||
break;
|
||||
}
|
||||
|
@ -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 */
|
||||
urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!urb) {
|
||||
netdev_err(netdev, "No memory left for URBs\n");
|
||||
err = -ENOMEM;
|
||||
break;
|
||||
}
|
||||
|
@ -651,10 +649,8 @@ static int peak_usb_restart(struct peak_usb_device *dev)
|
|||
|
||||
/* first allocate a urb to handle the asynchronous steps */
|
||||
urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
if (!urb) {
|
||||
netdev_err(dev->netdev, "no memory left for urb\n");
|
||||
if (!urb)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* also allocate enough space for the commands to send */
|
||||
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,
|
|||
|
||||
/* create a URB, and a buffer for it, and copy the data to the URB */
|
||||
urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
if (!urb) {
|
||||
netdev_err(netdev, "No memory left for URBs\n");
|
||||
if (!urb)
|
||||
goto nomem;
|
||||
}
|
||||
|
||||
buf = usb_alloc_coherent(priv->udev, size, GFP_ATOMIC,
|
||||
&urb->transfer_dma);
|
||||
|
@ -748,7 +746,6 @@ static int usb_8dev_start(struct usb_8dev_priv *priv)
|
|||
/* create a URB, and a buffer for it */
|
||||
urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!urb) {
|
||||
netdev_err(netdev, "No memory left for URBs\n");
|
||||
err = -ENOMEM;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2300,10 +2300,8 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
|
|||
serial->rx_data_length = rx_size;
|
||||
for (i = 0; i < serial->num_rx_urbs; i++) {
|
||||
serial->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!serial->rx_urb[i]) {
|
||||
dev_err(dev, "Could not allocate urb?\n");
|
||||
if (!serial->rx_urb[i])
|
||||
goto exit;
|
||||
}
|
||||
serial->rx_urb[i]->transfer_buffer = NULL;
|
||||
serial->rx_urb[i]->transfer_buffer_length = 0;
|
||||
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,
|
|||
|
||||
/* TX, allocate urb and initialize */
|
||||
serial->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!serial->tx_urb) {
|
||||
dev_err(dev, "Could not allocate urb?\n");
|
||||
if (!serial->tx_urb)
|
||||
goto exit;
|
||||
}
|
||||
serial->tx_urb->transfer_buffer = NULL;
|
||||
serial->tx_urb->transfer_buffer_length = 0;
|
||||
/* prepare our TX buffer */
|
||||
|
@ -2555,20 +2551,16 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface,
|
|||
/* start allocating */
|
||||
for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) {
|
||||
hso_net->mux_bulk_rx_urb_pool[i] = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!hso_net->mux_bulk_rx_urb_pool[i]) {
|
||||
dev_err(&interface->dev, "Could not allocate rx urb\n");
|
||||
if (!hso_net->mux_bulk_rx_urb_pool[i])
|
||||
goto exit;
|
||||
}
|
||||
hso_net->mux_bulk_rx_buf_pool[i] = kzalloc(MUX_BULK_RX_BUF_SIZE,
|
||||
GFP_KERNEL);
|
||||
if (!hso_net->mux_bulk_rx_buf_pool[i])
|
||||
goto exit;
|
||||
}
|
||||
hso_net->mux_bulk_tx_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!hso_net->mux_bulk_tx_urb) {
|
||||
dev_err(&interface->dev, "Could not allocate tx urb\n");
|
||||
if (!hso_net->mux_bulk_tx_urb)
|
||||
goto exit;
|
||||
}
|
||||
hso_net->mux_bulk_tx_buf = kzalloc(MUX_BULK_TX_BUF_SIZE, GFP_KERNEL);
|
||||
if (!hso_net->mux_bulk_tx_buf)
|
||||
goto exit;
|
||||
|
@ -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);
|
||||
if (!mux->shared_intr_urb) {
|
||||
dev_err(&interface->dev, "Could not allocate intr urb?\n");
|
||||
if (!mux->shared_intr_urb)
|
||||
goto exit;
|
||||
}
|
||||
mux->shared_intr_buf =
|
||||
kzalloc(le16_to_cpu(mux->intr_endp->wMaxPacketSize),
|
||||
GFP_KERNEL);
|
||||
|
|
|
@ -3002,10 +3002,8 @@ static void lan78xx_tx_bh(struct lan78xx_net *dev)
|
|||
|
||||
gso_skb:
|
||||
urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
if (!urb) {
|
||||
netif_dbg(dev, tx_err, dev->net, "no urb\n");
|
||||
if (!urb)
|
||||
goto drop;
|
||||
}
|
||||
|
||||
entry = (struct skb_data *)skb->cb;
|
||||
entry->urb = urb;
|
||||
|
|
|
@ -2062,11 +2062,8 @@ int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype,
|
|||
cmd, reqtype, value, index, size);
|
||||
|
||||
urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
if (!urb) {
|
||||
netdev_err(dev->net, "Error allocating URB in"
|
||||
" %s!\n", __func__);
|
||||
if (!urb)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (data) {
|
||||
buf = kmemdup(data, size, GFP_ATOMIC);
|
||||
|
|
|
@ -206,7 +206,6 @@ int i2400mu_notification_setup(struct i2400mu *i2400mu)
|
|||
i2400mu->notif_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!i2400mu->notif_urb) {
|
||||
ret = -ENOMEM;
|
||||
dev_err(dev, "notification: cannot allocate URB\n");
|
||||
goto error_alloc_urb;
|
||||
}
|
||||
epd = usb_get_epd(i2400mu->usb_iface,
|
||||
|
|
|
@ -706,10 +706,8 @@ static int ar5523_alloc_rx_bufs(struct ar5523 *ar)
|
|||
|
||||
data->ar = ar;
|
||||
data->urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!data->urb) {
|
||||
ar5523_err(ar, "could not allocate rx data urb\n");
|
||||
if (!data->urb)
|
||||
goto err;
|
||||
}
|
||||
list_add_tail(&data->list, &ar->rx_data_free);
|
||||
atomic_inc(&ar->rx_data_free_cnt);
|
||||
}
|
||||
|
@ -824,7 +822,6 @@ static void ar5523_tx_work_locked(struct ar5523 *ar)
|
|||
|
||||
urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!urb) {
|
||||
ar5523_err(ar, "Failed to allocate TX urb\n");
|
||||
ieee80211_free_txskb(ar->hw, skb);
|
||||
continue;
|
||||
}
|
||||
|
@ -949,10 +946,8 @@ static int ar5523_alloc_tx_cmd(struct ar5523 *ar)
|
|||
init_completion(&cmd->done);
|
||||
|
||||
cmd->urb_tx = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!cmd->urb_tx) {
|
||||
ar5523_err(ar, "could not allocate urb\n");
|
||||
if (!cmd->urb_tx)
|
||||
return -ENOMEM;
|
||||
}
|
||||
cmd->buf_tx = usb_alloc_coherent(ar->dev, AR5523_MAX_TXCMDSZ,
|
||||
GFP_KERNEL,
|
||||
&cmd->urb_tx->transfer_dma);
|
||||
|
|
|
@ -1099,15 +1099,11 @@ struct brcmf_usbdev *brcmf_usb_attach(struct brcmf_usbdev_info *devinfo,
|
|||
devinfo->tx_freecount = ntxq;
|
||||
|
||||
devinfo->ctl_urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
if (!devinfo->ctl_urb) {
|
||||
brcmf_err("usb_alloc_urb (ctl) failed\n");
|
||||
if (!devinfo->ctl_urb)
|
||||
goto error;
|
||||
}
|
||||
devinfo->bulk_urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
if (!devinfo->bulk_urb) {
|
||||
brcmf_err("usb_alloc_urb (bulk) failed\n");
|
||||
if (!devinfo->bulk_urb)
|
||||
goto error;
|
||||
}
|
||||
|
||||
return &devinfo->bus_pub;
|
||||
|
||||
|
|
|
@ -1613,10 +1613,8 @@ static int ezusb_probe(struct usb_interface *interface,
|
|||
}
|
||||
|
||||
upriv->read_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!upriv->read_urb) {
|
||||
err("No free urbs available");
|
||||
if (!upriv->read_urb)
|
||||
goto error;
|
||||
}
|
||||
if (le16_to_cpu(ep->wMaxPacketSize) != 64)
|
||||
pr_warn("bulk in: wMaxPacketSize!= 64\n");
|
||||
if (ep->bEndpointAddress != (2 | USB_DIR_IN))
|
||||
|
|
|
@ -198,22 +198,16 @@ static int if_usb_probe(struct usb_interface *intf,
|
|||
}
|
||||
|
||||
cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!cardp->rx_urb) {
|
||||
lbtf_deb_usbd(&udev->dev, "Rx URB allocation failed\n");
|
||||
if (!cardp->rx_urb)
|
||||
goto dealloc;
|
||||
}
|
||||
|
||||
cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!cardp->tx_urb) {
|
||||
lbtf_deb_usbd(&udev->dev, "Tx URB allocation failed\n");
|
||||
if (!cardp->tx_urb)
|
||||
goto dealloc;
|
||||
}
|
||||
|
||||
cardp->cmd_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!cardp->cmd_urb) {
|
||||
lbtf_deb_usbd(&udev->dev, "Cmd URB allocation failed\n");
|
||||
if (!cardp->cmd_urb)
|
||||
goto dealloc;
|
||||
}
|
||||
|
||||
cardp->ep_out_buf = kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE,
|
||||
GFP_KERNEL);
|
||||
|
|
|
@ -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.urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!card->tx_cmd.urb) {
|
||||
mwifiex_dbg(adapter, ERROR,
|
||||
"tx_cmd.urb allocation failed\n");
|
||||
if (!card->tx_cmd.urb)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
for (i = 0; i < MWIFIEX_TX_DATA_PORT; i++) {
|
||||
port = &card->port[i];
|
||||
|
@ -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].urb =
|
||||
usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!port->tx_data_list[j].urb) {
|
||||
mwifiex_dbg(adapter, ERROR,
|
||||
"urb allocation failed\n");
|
||||
if (!port->tx_data_list[j].urb)
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!card->rx_cmd.urb) {
|
||||
mwifiex_dbg(adapter, ERROR, "rx_cmd.urb allocation failed\n");
|
||||
if (!card->rx_cmd.urb)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
card->rx_cmd.skb = dev_alloc_skb(MWIFIEX_RX_CMD_BUF_SIZE);
|
||||
if (!card->rx_cmd.skb)
|
||||
|
@ -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].urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!card->rx_data_list[i].urb) {
|
||||
mwifiex_dbg(adapter, ERROR,
|
||||
"rx_data_list[] urb allocation failed\n");
|
||||
if (!card->rx_data_list[i].urb)
|
||||
return -1;
|
||||
}
|
||||
if (mwifiex_usb_submit_rx_urb(&card->rx_data_list[i],
|
||||
MWIFIEX_RX_DATA_BUF_SIZE))
|
||||
return -1;
|
||||
|
|
|
@ -739,11 +739,8 @@ static int _rtl_usb_receive(struct ieee80211_hw *hw)
|
|||
for (i = 0; i < rtlusb->rx_urb_num; i++) {
|
||||
err = -ENOMEM;
|
||||
urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!urb) {
|
||||
RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
|
||||
"Failed to alloc URB!!\n");
|
||||
if (!urb)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
err = _rtl_prep_rx_urb(hw, rtlusb, urb, GFP_KERNEL);
|
||||
if (err < 0) {
|
||||
|
@ -907,15 +904,12 @@ static void _rtl_tx_complete(struct urb *urb)
|
|||
static struct urb *_rtl_usb_tx_urb_setup(struct ieee80211_hw *hw,
|
||||
struct sk_buff *skb, u32 ep_num)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw));
|
||||
struct urb *_urb;
|
||||
|
||||
WARN_ON(NULL == skb);
|
||||
_urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
if (!_urb) {
|
||||
RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
|
||||
"Can't allocate URB for bulk out!\n");
|
||||
kfree_skb(skb);
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue