Skip to content

Commit 494fc02

Browse files
can: gs_usb: gs_usb_receive_bulk_callback(): fix error message
Sinc commit 79a6d1b ("can: gs_usb: gs_usb_receive_bulk_callback(): unanchor URL on usb_submit_urb() error") a failing resubmit URB will print an info message. In the case of a short read where netdev has not yet been assigned, initialize as NULL to avoid dereferencing an undefined value. Also report the error value of the failed resubmit. Fixes: 79a6d1b ("can: gs_usb: gs_usb_receive_bulk_callback(): unanchor URL on usb_submit_urb() error") Reported-by: Jakub Kicinski <kuba@kernel.org> Closes: https://lore.kernel.org/all/20260119181904.1209979-1-kuba@kernel.org/ Link: https://patch.msgid.link/20260120-gs_usb-fix-error-message-v1-1-6be04de572bc@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
1 parent 0baa4d3 commit 494fc02

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/net/can/usb/gs_usb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ static void gs_usb_receive_bulk_callback(struct urb *urb)
610610
{
611611
struct gs_usb *parent = urb->context;
612612
struct gs_can *dev;
613-
struct net_device *netdev;
613+
struct net_device *netdev = NULL;
614614
int rc;
615615
struct net_device_stats *stats;
616616
struct gs_host_frame *hf = urb->transfer_buffer;
@@ -768,7 +768,7 @@ static void gs_usb_receive_bulk_callback(struct urb *urb)
768768
}
769769
} else if (rc != -ESHUTDOWN && net_ratelimit()) {
770770
netdev_info(netdev, "failed to re-submit IN URB: %pe\n",
771-
ERR_PTR(urb->status));
771+
ERR_PTR(rc));
772772
}
773773
}
774774

0 commit comments

Comments
 (0)