can: gs_usb: gs_can_start_xmit(), gs_can_open(): clean up printouts in error path
authorMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 12 Jul 2023 13:49:43 +0000 (15:49 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Fri, 28 Jul 2023 06:52:03 +0000 (08:52 +0200)
Remove unnecessary "out of memory" message from the error path of
gs_can_start_xmit() and gs_can_open().

Convert the printout in case of a failing usb_submit_urb() in
gs_can_open() from numbers to human readable error codes.

Link: https://lore.kernel.org/all/20230718-gs_usb-cleanups-v1-8-c3b9154ec605@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/gs_usb.c

index e302d7d..a5cab6a 100644 (file)
@@ -741,10 +741,8 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb,
                goto nomem_urb;
 
        hf = kmalloc(dev->hf_size_tx, GFP_ATOMIC);
-       if (!hf) {
-               netdev_err(netdev, "No memory left for USB buffer\n");
+       if (!hf)
                goto nomem_hf;
-       }
 
        idx = txc->echo_id;
 
@@ -877,8 +875,6 @@ static int gs_can_open(struct net_device *netdev)
                        buf = kmalloc(dev->parent->hf_size_rx,
                                      GFP_KERNEL);
                        if (!buf) {
-                               netdev_err(netdev,
-                                          "No memory left for USB buffer\n");
                                rc = -ENOMEM;
                                goto out_usb_free_urb;
                        }
@@ -901,7 +897,8 @@ static int gs_can_open(struct net_device *netdev)
                                        netif_device_detach(dev->netdev);
 
                                netdev_err(netdev,
-                                          "usb_submit failed (err=%d)\n", rc);
+                                          "usb_submit_urb() failed, error %pe\n",
+                                          ERR_PTR(rc));
 
                                goto out_usb_unanchor_urb;
                        }