Netdev List
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, linux-can@vger.kernel.org,
	kernel@pengutronix.de, Marc Kleine-Budde <mkl@pengutronix.de>,
	Sashiko <sashiko-bot@kernel.org>
Subject: [PATCH net-next 8/9] can: gs_usb: gs_usb_receive_bulk_callback(): use dev_info_ratelimited() to print re-submit info messages
Date: Mon, 30 Nov 2026 10:15:34 +0100	[thread overview]
Message-ID: <20261130092003.1946901-9-mkl@pengutronix.de> (raw)
In-Reply-To: <20261130092003.1946901-1-mkl@pengutronix.de>

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 <sashiko-bot@kernel.org>
Closes: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260729102802.505168-1-mkl@pengutronix.de
Link: https://patch.msgid.link/20261130-gs_usb-fixes-v12-8-9ba1f84c179a@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@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 2b23246fb8eb..10769296c6e0 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


  parent reply	other threads:[~2026-11-30  9:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  9:15 [PATCH net-next 0/9] pull-request: can-next 2026-11-30 Marc Kleine-Budde
2026-11-30  9:15 ` [PATCH net-next 1/9] can: gs_usb: gs_usb_probe(): init netdev completely before register_candev() Marc Kleine-Budde
2026-11-30  9:23   ` netdev-bot+sinfo
2026-11-30  9:15 ` [PATCH net-next 2/9] can: gs_usb: gs_usb_receive_bulk_callback(): update state even if SKB allocations fails Marc Kleine-Budde
2026-11-30  9:15 ` [PATCH net-next 3/9] can: gs_usb: gs_usb_receive_bulk_callback(): check for overflow flag if SKB allocation fails Marc Kleine-Budde
2026-11-30  9:15 ` [PATCH net-next 4/9] can: gs_usb: gs_usb_receive_bulk_callback(): add missing call to can_rx_offload_irq_finish Marc Kleine-Budde
2026-11-30  9:15 ` [PATCH net-next 5/9] can: gs_usb: fix hardware timestamp state for mixed channels Marc Kleine-Budde
2026-11-30  9:15 ` [PATCH net-next 6/9] can: gs_usb: add support for context analysis Marc Kleine-Budde
2026-11-30  9:15 ` [PATCH net-next 7/9] can: gs_usb: gs_make_candev(): check can_rx_offload_add_manual() return value Marc Kleine-Budde
2026-11-30  9:15 ` Marc Kleine-Budde [this message]
2026-11-30  9:15 ` [PATCH net-next 9/9] can: gs_usb: gs_usb_receive_bulk_callback(): emit error message on invalid channel instead of disconnecting interfaces Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130092003.1946901-9-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=davem@davemloft.net \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sashiko-bot@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox