Linux CAN drivers development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kendall Willis" <k-willis@ti.com>
Cc: "Vincent Mailhol" <mailhol@kernel.org>,
	linux-can@vger.kernel.org,
	"Marc Kleine-Budde" <mkl@pengutronix.de>,
	devicetree@vger.kernel.org,
	"Oleksij Rempel" <o.rempel@pengutronix.de>,
	conor+dt@kernel.org, robh@kernel.org,
	"Oliver Hartkopp" <socketcan@hartkopp.net>
Subject: Re: [PATCH v5 2/2] can: m_can: add ti,am62-mcan compatible with out-of-band wakeup support
Date: Sat, 12 Sep 2026 21:35:35 +0000	[thread overview]
Message-ID: <20260912213536.211151F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260912-temp-v5-2-2e3201c02109@ti.com>

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

Pre-existing issues:
- [High] Missing rollback in m_can_class_suspend error path leaves device permanently unusable if deinit fails.
--

commit f4778144b1ead7bde54359bb563953cd8601ac93
Author: Kendall Willis <k-willis@ti.com>

can: m_can: add ti,am62-mcan compatible with out-of-band wakeup support

This commit introduces the ti,am62-mcan compatible with match data to
identify the out-of-band wakeup capability for TI AM62 SoCs. It also
updates the suspend path to set the out-of-band wakeup flag when
the device is configured appropriately.

> diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
> index 16f80607e150e..67ac6995a7f27 100644
> --- a/drivers/net/can/m_can/m_can.c
> +++ b/drivers/net/can/m_can/m_can.c
> @@ -2622,8 +2622,14 @@ int m_can_class_suspend(struct device *dev)
>  		cdev->can.state = CAN_STATE_SLEEPING;
>  	}
>  
> -	if (!m_can_class_wakeup_pinctrl_enabled(cdev))
> -		pinctrl_pm_select_sleep_state(dev);
> +	if (!ret) {
> +		if (m_can_class_wakeup_pinctrl_enabled(cdev)) {
> +			if (cdev->out_band_wakeup)
> +				device_set_out_band_wakeup(dev);
> +		} else {
> +			pinctrl_pm_select_sleep_state(dev);
> +		}
> +	}
>  
>  	return ret;
>  }

[Severity: High]
This is a pre-existing issue, but could this error path leave the CAN device
permanently unusable?

If cdev->ops->deinit() returns a negative error code (e.g. due to an SPI
error in a peripheral driver), ret is set, but m_can_class_suspend()
unconditionally stops the clocks and changes the state earlier in the
function:

    if (cdev->pm_wake_source) {
        ...
        if (cdev->ops->deinit)
            ret = cdev->ops->deinit(cdev);
    } else {
        m_can_stop(ndev);
    }

    m_can_clk_stop(cdev);
    cdev->can.state = CAN_STATE_SLEEPING;

If an error is returned to the PM core, the suspend operation is aborted
and the resume callback is never invoked. Does this leave the network
interface detached via netif_device_detach(), its clocks stopped, and the
state stuck in CAN_STATE_SLEEPING indefinitely without a manual module
reload?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260912-temp-v5-0-2e3201c02109@ti.com?part=2

      reply	other threads:[~2026-09-12 21:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-12 21:26 [PATCH v5 0/2] can: m_can: introduce ti,am62-mcan compatible for out-of-band wakeup Kendall Willis
2026-09-12 21:26 ` [PATCH v5 1/2] dt-bindings: can: m_can: add ti,am62-mcan compatible Kendall Willis
2026-09-12 21:37   ` sashiko-bot
2026-09-13  7:54   ` Krzysztof Kozlowski
2026-09-12 21:26 ` [PATCH v5 2/2] can: m_can: add ti,am62-mcan compatible with out-of-band wakeup support Kendall Willis
2026-09-12 21:35   ` sashiko-bot [this message]

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=20260912213536.211151F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=k-willis@ti.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mailhol@kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=o.rempel@pengutronix.de \
    --cc=robh@kernel.org \
    --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