Linux CAN drivers development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Stéphane Grosjean" <s.grosjean@peak-system.fr>
Cc: linux-can@vger.kernel.org,
	"Marc Kleine-Budde" <mkl@pengutronix.de>,
	"Oliver Hartkopp" <socketcan@hartkopp.net>,
	"Vincent Mailhol" <mailhol@kernel.org>,
	"Oleksij Rempel" <o.rempel@pengutronix.de>
Subject: Re: [PATCH v9 07/14] can: peak_usb: register the netdevs only once all channels are set up
Date: Thu, 26 Nov 2026 09:11:30 +0000	[thread overview]
Message-ID: <sashiko-outbox-235102@kernel.org> (raw)
In-Reply-To: <20261126-canfd_check_channel_idx-v9-7-abe0099b4585@peak-system.fr>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] can: peak_usb: probe command helpers log via netdev_err() before
  registration
--

commit dabb2fbe077091ab1e816680a5ac7e4a6fe596f6
Author: Stéphane Grosjean <s.grosjean@peak-system.fr>

can: peak_usb: register the netdevs only once all channels are set up

This commit defers registering the CAN netdevs until all channels of an
interface have been initialized in peak_usb_probe(), and tracks registered
channels with PCAN_USB_STATE_REGISTERED for cleanup in
peak_usb_disconnect().

> diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c
> index 90f69afcba974..451d084215049 100644
> --- a/drivers/net/can/usb/peak_usb/pcan_usb.c
> +++ b/drivers/net/can/usb/peak_usb/pcan_usb.c
> @@ -390,9 +390,12 @@ static int pcan_usb_get_can_channel_id(struct peak_usb_device *dev, u32 *can_ch_
>  	int err;
>  
>  	err = pcan_usb_wait_rsp(dev, PCAN_USB_CMD_DEVID, PCAN_USB_GET, args);
> +	/* explicit use of dev_xxx() instead of netdev_xxx() here: this is
> +	 * also called during probe, before the netdev is registered.
> +	 */
>  	if (err)
> -		netdev_err(dev->netdev, "getting can channel id failure: %d\n", err);
> -
> +		dev_err(dev->netdev->dev.parent,
> +			"getting can channel id failure: %d\n", err);
>  	else
>  		*can_ch_id = args[0];
>  

[Severity: Low]
Should the command helpers called during probe before register_candev()
also use dev_err() instead of netdev_err()?

pcan_usb_get_can_channel_id(), dev_init(), and dev_set_bus() call helpers
such as pcan_usb_wait_rsp(), pcan_usb_send_cmd(), pcan_usb_pro_send_cmd(),
pcan_usb_pro_wait_rsp(), pcan_usb_pro_send_req(), and
pcan_usb_fd_send_cmd(), which still log errors via netdev_err(dev->netdev,
...) on an unregistered net_device during peak_usb_create_dev().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126-canfd_check_channel_idx-v9-0-abe0099b4585@peak-system.fr?part=7

  reply	other threads:[~2026-11-26  9:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  9:01 [PATCH v9 00/14] can: peak_usb: fixes and input validation hardening Stéphane Grosjean via B4 Relay
2026-11-26  9:01 ` [PATCH v9 01/14] can: peak_usb: fix missing CAN_ERR_FLAG when reporting error counters Stéphane Grosjean via B4 Relay
2026-11-26  9:01 ` [PATCH v9 02/14] can: peak_usb: harden PCAN-USB message validation Stéphane Grosjean via B4 Relay
2026-11-26  9:01 ` [PATCH v9 03/14] can: peak_usb: replace open-coded bitmask operations with bitops Stéphane Grosjean via B4 Relay
2026-11-26  9:01 ` [PATCH v9 04/14] can: peak_usb: harden channel handling in PCAN-USB FD Stéphane Grosjean via B4 Relay
2026-11-26  9:01 ` [PATCH v9 05/14] can: peak_usb: fix RX cursor desync for self-received RTR frames with SRR Stéphane Grosjean via B4 Relay
2026-11-26  9:01 ` [PATCH v9 06/14] can: peak_usb: reject records for unset channels in PCAN-USB Pro Stéphane Grosjean via B4 Relay
2026-11-26  9:01 ` [PATCH v9 07/14] can: peak_usb: register the netdevs only once all channels are set up Stéphane Grosjean via B4 Relay
2026-11-26  9:11   ` sashiko-bot [this message]
2026-11-26 12:00     ` Stéphane Grosjean
2026-11-26  9:01 ` [PATCH v9 08/14] can: peak_usb: validate the data length of PCAN-USB Pro CAN records Stéphane Grosjean via B4 Relay
2026-11-26  9:01 ` [PATCH v9 09/14] can: peak_usb: don't read past the message in PCAN-USB Pro decoders Stéphane Grosjean via B4 Relay
2026-11-26  9:01 ` [PATCH v9 10/14] can: peak_usb: dump undecodable URBs once and rate limit decode errors Stéphane Grosjean via B4 Relay
2026-11-26  9:01 ` [PATCH v9 11/14] can: peak_usb: don't return an uninitialized PCAN-USB CAN channel ID Stéphane Grosjean via B4 Relay
2026-11-26  9:01 ` [PATCH v9 12/14] can: peak_usb: pass the dev_num argument of PCAN-USB Pro GETDEVID Stéphane Grosjean via B4 Relay
2026-11-26  9:01 ` [PATCH v9 13/14] can: peak_usb: don't send uninitialized stack bytes to PCAN-USB devices Stéphane Grosjean via B4 Relay
2026-11-26  9:01 ` [PATCH v9 14/14] can: peak_usb: don't send uninitialized heap bytes in restart commands Stéphane Grosjean via B4 Relay

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=sashiko-outbox-235102@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=mailhol@kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=o.rempel@pengutronix.de \
    --cc=s.grosjean@peak-system.fr \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=socketcan@hartkopp.net \
    /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