Linux CAN drivers development
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: mkl@pengutronix.de
Cc: mailhol@kernel.org, pfink@christ-es.de, eric@evenchick.com,
	max@schneidersoft.net, wg@grandegger.com, kernel@pengutronix.de,
	linux-can@vger.kernel.org, shuangpeng.kernel@gmail.com,
	stable@vger.kernel.org, vadim.fedorenko@linux.dev,
	kuba@kernel.org
Subject: Re: [PATCH can-next v9 05/13] can: gs_usb: fix hardware timestamp state for mixed channels
Date: Mon, 23 Nov 2026 12:00:22 +0000	[thread overview]
Message-ID: <179543522241.3131.6628219369362226414@kernel.org> (raw)
In-Reply-To: <20261121-gs_usb-fixes-v9-5-db121d488945@pengutronix.de>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] In drivers/net/can/usb/gs_usb.c, gs_can_open() has an
  unbalanced brace in the new gs_usb_timestamp_start() error handling,…

--

can: gs_usb: fix hardware timestamp state for mixed channels

The HW timestamp infrastructure is now set up in gs_usb_probe() when any
channel advertises GS_CAN_FEATURE_HW_TIMESTAMP. Initial time sync and the
scheduling of the delayed worker move into a new gs_usb_timestamp_start(),
which runs when the first channel is opened. Shutdown is keyed off a new
per-parent flag instead of the feature bits of the last channel closed.

> diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
> index 470dd52d97dfe..30bcb734c5df8 100644
> --- a/drivers/net/can/usb/gs_usb.c
> +++ b/drivers/net/can/usb/gs_usb.c

[ ... ]

> @@ -990,9 +1030,19 @@ static int gs_can_open(struct net_device *netdev)
>  
>  	can_rx_offload_enable(&dev->offload);
>  
> +	/* rely on RTNL to serialize concurrent ifup/ifdown */
> +	ASSERT_RTNL();
> +
>  	if (!parent->active_channels) {
> -		if (dev->feature & GS_CAN_FEATURE_HW_TIMESTAMP)
> -			gs_usb_timestamp_init(parent);
> +		if (parent->flags & GS_USB_PARENT_FLAGS_HW_TIMESTAMP) {
> +			rc = gs_usb_timestamp_start(parent);
> +			if (rc) {
> +				if (rc == -ENODEV) {
                                                   ^

[Severity: Medium]
Is there a stray opening brace here? Nothing closes it, so the two closing
braces below end the -ENODEV block and the if (rc) block. The
if (parent->flags & GS_USB_PARENT_FLAGS_HW_TIMESTAMP) block is left open.

Every later closing brace in gs_can_open() is then off by one. The
function's final brace after the out_can_rx_offload_disable label no
longer ends gs_can_open(), so the next definition is parsed as a nested
function:

    static int gs_usb_get_state(const struct net_device *netdev,

That doesn't compile, so drivers/net/can/usb/gs_usb.c can't be built at
this commit and bisection through it breaks.

The goto out_can_rx_offload_disable also ends up inside the -ENODEV block.
The commit message says a failed initial timestamp read should make the
open fail. The usb_submit_urb() error handling in the RX URB loop follows
that pattern, detaching only on -ENODEV but always taking the goto:

    rc = usb_submit_urb(urb, GFP_KERNEL);
    if (rc) {
        if (rc == -ENODEV)
            netif_device_detach(dev->netdev);
        ...
        goto out_usb_unanchor_urb;
    }

Should this be if (rc == -ENODEV) without the brace?

The next patch in the series, "can: gs_usb: add support for context
analysis", removes this brace, but that patch isn't tagged for stable.
This patch has Cc: stable@vger.kernel.org. Would backporting it on its
own give stable trees a driver that doesn't build?

> +					netif_device_detach(netdev);
> +
> +				goto out_can_rx_offload_disable;
> +			}
> +		}
>  
>  		for (i = 0; i < GS_MAX_RX_URBS; i++) {
>  			u8 *buf;

[ ... ]

> @@ -1107,10 +1157,10 @@ static int gs_can_open(struct net_device *netdev)
>  	if (!parent->active_channels) {
>  		usb_kill_anchored_urbs(&parent->rx_submitted);
>  
> -		if (dev->feature & GS_CAN_FEATURE_HW_TIMESTAMP)
> +		if (parent->flags & GS_USB_PARENT_FLAGS_HW_TIMESTAMP)
>  			gs_usb_timestamp_stop(parent);
>  	}
> -
> +out_can_rx_offload_disable:
>  	can_rx_offload_disable(&dev->offload);
>  	close_candev(netdev);
>  

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261121-gs_usb-fixes-v9-0-db121d488945%40pengutronix.de

  parent reply	other threads:[~2026-11-23 12:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-21 22:35 [PATCH can-next v9 00/13] gs_usb: fixes Marc Kleine-Budde
2026-11-21 22:35 ` [PATCH can-next v9 01/13] can: gs_usb: gs_usb_probe(): init netdev completely before register_candev() Marc Kleine-Budde
2026-11-21 22:36 ` [PATCH can-next v9 02/13] can: gs_usb: gs_usb_receive_bulk_callback(): check for overflow flag if SKB allocation fails Marc Kleine-Budde
2026-11-21 22:36 ` [PATCH can-next v9 03/13] can: gs_usb: gs_usb_receive_bulk_callback(): add missing call to can_rx_offload_irq_finish Marc Kleine-Budde
2026-11-21 22:36 ` [PATCH can-next v9 04/13] can: gs_usb: use spin_lock_irqsave() instead of spin_lock_bh() to protect struct gs_usb::tc Marc Kleine-Budde
2026-11-21 22:36 ` [PATCH can-next v9 05/13] can: gs_usb: fix hardware timestamp state for mixed channels Marc Kleine-Budde
2026-11-21 22:43   ` sashiko-bot
2026-11-23 12:00   ` netdev-bot+sashiko [this message]
2026-11-21 22:36 ` [PATCH can-next v9 06/13] can: gs_usb: add support for context analysis Marc Kleine-Budde
2026-11-21 22:42   ` sashiko-bot
2026-11-23 12:00   ` netdev-bot+sashiko
2026-11-21 22:36 ` [PATCH can-next v9 07/13] can: gs_usb: gs_make_candev(): check can_rx_offload_add_manual() return value Marc Kleine-Budde
2026-11-21 22:36 ` [PATCH can-next v9 08/13] can: gs_usb: gs_usb_receive_bulk_callback(): use dev_info() to print re-submit info messages Marc Kleine-Budde
2026-11-21 22:42   ` sashiko-bot
2026-11-23 12:00   ` netdev-bot+sashiko
2026-11-21 22:36 ` [PATCH can-next v9 09/13] can: gs_usb: gs_usb_get_gs_can(): introduce new function to consolidate validation of struct gs_can Marc Kleine-Budde
2026-11-23 12:00   ` netdev-bot+sashiko
2026-11-21 22:36 ` [PATCH can-next v9 10/13] can: gs_usb: gs_usb_get_gs_can(): report channel number out of range error Marc Kleine-Budde
2026-11-23 12:00   ` netdev-bot+sashiko
2026-11-21 22:36 ` [PATCH can-next v9 11/13] can: gs_usb: gs_usb_get_rx_data_length(): introduce new function to consolidate validation of host frame Marc Kleine-Budde
2026-11-23 12:00   ` netdev-bot+sashiko
2026-11-21 22:36 ` [PATCH can-next v9 12/13] can: gs_usb: gs_usb_host_frame_header_valid(): drop invalid CAN error frames Marc Kleine-Budde
2026-11-21 22:53   ` sashiko-bot
2026-11-21 23:02     ` Marc Kleine-Budde
2026-11-23  7:41     ` Marc Kleine-Budde
2026-11-23 12:00   ` netdev-bot+sashiko
2026-11-21 22:36 ` [PATCH can-next v9 13/13] can: gs_usb: gs_usb_host_frame_header_valid(): drop CAN frames with invalid DLC Marc Kleine-Budde
2026-11-23 12:00   ` netdev-bot+sashiko

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=179543522241.3131.6628219369362226414@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=eric@evenchick.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=mailhol@kernel.org \
    --cc=max@schneidersoft.net \
    --cc=mkl@pengutronix.de \
    --cc=pfink@christ-es.de \
    --cc=shuangpeng.kernel@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=vadim.fedorenko@linux.dev \
    --cc=wg@grandegger.com \
    /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