If an URB is retransmitted (due to an error) before the network device can be identified, and if this retransmission fails, netdev_info() operates with a NULL pointer for the network device. Although this does not cause a system crash, it does not provide any information about which device is affected. Replace net_ratelimit and netdev_info() with dev_info_ratelimited() to output the affected USB device. While there, remove the NULL pointer initialization for netdev, as it's not longer needed. Reported-by: Sashiko <sash…@kernel.org> Closes: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…@pengutronix.de Fixes: 79a6d1bfe114 ("can: gs_usb: gs_usb_receive_bulk_callback(): unanchor URL on usb_submit_urb() error") Cc: stab…@vger.kernel.org Link: https://patch.msgid.link/2026…@pengutronix.de Signed-off-by: Marc Kleine-Budde <m…@pengutronix.de> --- drivers/net/can/usb/gs_usb.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c index c48a8e97c3ab..40d867b830cf 100644 --- a/drivers/net/can/usb/gs_usb.c +++ b/drivers/net/can/usb/gs_usb.c @@ -633,11 +633,11 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) { struct gs_usb *parent = urb->context; struct gs_can *dev; - struct net_device *netdev = NULL; int rc; struct net_device_stats *stats; struct gs_host_frame *hf = urb->transfer_buffer; unsigned int minimum_length, data_length; + struct net_device *netdev; struct gs_tx_context *txc; struct can_frame *cf; struct canfd_frame *cfd; @@ -797,9 +797,10 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) if (parent->canch[rc]) netif_device_detach(parent->canch[rc]->netdev); } - } else if (rc != -ESHUTDOWN && net_ratelimit()) { - netdev_info(netdev, "failed to re-submit IN URB: %pe\n", - ERR_PTR(rc)); + } else if (rc != -ESHUTDOWN) { + dev_info_ratelimited(&parent->udev->dev, + "failed to re-submit IN URB: %pe\n", + ERR_PTR(rc)); } }
-- 2.53.0