2016-08-11 21:12:28

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 00/16] 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.


Wolfram Sang (16):
net: can: usb: ems_usb: don't print error when allocating urb fails
net: can: usb: esd_usb2: don't print error when allocating urb fails
net: can: usb: gs_usb: don't print error when allocating urb fails
net: can: usb: kvaser_usb: don't print error when allocating urb fails
net: can: usb: peak_usb: pcan_usb_core: don't print error when
allocating urb fails
net: can: usb: usb_8dev: don't print error when allocating urb fails
net: usb: hso: don't print error when allocating urb fails
net: usb: lan78xx: don't print error when allocating urb fails
net: usb: usbnet: don't print error when allocating urb fails
net: wimax: i2400m: usb-notif: don't print error when allocating urb
fails
net: wireless: ath: ar5523: ar5523: don't print error when allocating
urb fails
net: wireless: broadcom: brcm80211: brcmfmac: usb: don't print error
when allocating urb fails
net: wireless: intersil: orinoco: orinoco_usb: don't print error when
allocating urb fails
net: wireless: marvell: libertas_tf: if_usb: don't print error when
allocating urb fails
net: wireless: marvell: mwifiex: usb: don't print error when
allocating urb fails
net: wireless: realtek: rtlwifi: usb: don't print error when
allocating urb fails

drivers/net/can/usb/ems_usb.c | 9 ++-------
drivers/net/can/usb/esd_usb2.c | 3 ---
drivers/net/can/usb/gs_usb.c | 9 ++-------
drivers/net/can/usb/kvaser_usb.c | 7 +------
drivers/net/can/usb/peak_usb/pcan_usb_core.c | 6 +-----
drivers/net/can/usb/usb_8dev.c | 5 +----
drivers/net/usb/hso.c | 20 +++++---------------
drivers/net/usb/lan78xx.c | 4 +---
drivers/net/usb/usbnet.c | 5 +----
drivers/net/wimax/i2400m/usb-notif.c | 1 -
drivers/net/wireless/ath/ar5523/ar5523.c | 9 ++-------
.../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 8 ++------
drivers/net/wireless/intersil/orinoco/orinoco_usb.c | 4 +---
drivers/net/wireless/marvell/libertas_tf/if_usb.c | 12 +++---------
drivers/net/wireless/marvell/mwifiex/usb.c | 19 ++++---------------
drivers/net/wireless/realtek/rtlwifi/usb.c | 8 +-------
16 files changed, 27 insertions(+), 102 deletions(-)

--
2.8.1



2016-08-11 21:13:37

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 14/16] net: wireless: marvell: libertas_tf: if_usb: don't print error when allocating urb fails

kmalloc will print enough information in case of failure.

Signed-off-by: Wolfram Sang <[email protected]>
---
drivers/net/wireless/marvell/libertas_tf/if_usb.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/marvell/libertas_tf/if_usb.c b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
index 799a2efe579372..e0ade40d9497d7 100644
--- a/drivers/net/wireless/marvell/libertas_tf/if_usb.c
+++ b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
@@ -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);
--
2.8.1


2016-08-11 21:12:37

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 11/16] net: wireless: ath: ar5523: ar5523: don't print error when allocating urb fails

kmalloc will print enough information in case of failure.

Signed-off-by: Wolfram Sang <[email protected]>
---
drivers/net/wireless/ath/ar5523/ar5523.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c
index 8aded24bcdf49e..7a60d2e652dad6 100644
--- a/drivers/net/wireless/ath/ar5523/ar5523.c
+++ b/drivers/net/wireless/ath/ar5523/ar5523.c
@@ -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);
--
2.8.1


2016-08-14 08:43:23

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 00/16] net: don't print error when allocating urb fails

From: Wolfram Sang <[email protected]>
Date: Thu, 11 Aug 2016 23:05:19 +0200

> 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.

Series applied to net-next, thank you.

2016-08-11 21:13:38

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 16/16] net: wireless: realtek: rtlwifi: usb: don't print error when allocating urb fails

kmalloc will print enough information in case of failure.

Signed-off-by: Wolfram Sang <[email protected]>
---
drivers/net/wireless/realtek/rtlwifi/usb.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c
index 41617b7b082260..32aa5c1d070a07 100644
--- a/drivers/net/wireless/realtek/rtlwifi/usb.c
+++ b/drivers/net/wireless/realtek/rtlwifi/usb.c
@@ -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;
}
--
2.8.1


2016-08-11 21:12:39

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 12/16] net: wireless: broadcom: brcm80211: brcmfmac: usb: don't print error when allocating urb fails

kmalloc will print enough information in case of failure.

Signed-off-by: Wolfram Sang <[email protected]>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
index 98b15a9a2779f4..fa26619a7945d9 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
@@ -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;

--
2.8.1


2016-08-11 21:13:37

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 15/16] net: wireless: marvell: mwifiex: usb: don't print error when allocating urb fails

kmalloc will print enough information in case of failure.

Signed-off-by: Wolfram Sang <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/usb.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c
index 0857575c5c39fe..3bd04f52f36988 100644
--- a/drivers/net/wireless/marvell/mwifiex/usb.c
+++ b/drivers/net/wireless/marvell/mwifiex/usb.c
@@ -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;
--
2.8.1


2016-08-11 21:35:54

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH 16/16] net: wireless: realtek: rtlwifi: usb: don't print error when allocating urb fails

On 08/11/2016 04:13 PM, Wolfram Sang wrote:
> kmalloc will print enough information in case of failure.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> ---
> drivers/net/wireless/realtek/rtlwifi/usb.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)

Acked-by: Larry Finger <[email protected]>

>
> diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c
> index 41617b7b082260..32aa5c1d070a07 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/usb.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/usb.c
> @@ -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;
> }
>


2016-08-11 21:13:35

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 13/16] net: wireless: intersil: orinoco: orinoco_usb: don't print error when allocating urb fails

kmalloc will print enough information in case of failure.

Signed-off-by: Wolfram Sang <[email protected]>
---
drivers/net/wireless/intersil/orinoco/orinoco_usb.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
index 56f109bc83945d..bca6935a94db9a 100644
--- a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
+++ b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
@@ -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))
--
2.8.1