From: sashiko-bot@kernel.org
To: "Markus Schneider-Pargmann" <msp@baylibre.com>
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 v2 2/2] can: tcan4x5x: Add suspend error handling
Date: Fri, 16 Oct 2026 10:05:11 +0000 [thread overview]
Message-ID: <sashiko-outbox-174121@kernel.org> (raw)
In-Reply-To: <20261016-v7-3-topic-mcan-suspend-fix-fix-v2-2-7efa2b172cce@baylibre.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] irq: unbalanced IRQ wake disable on suspend error path
--
commit 35cb9abaa9dd12aabf550562b5fe36f26129d629
Author: Markus Schneider-Pargmann <msp@baylibre.com>
can: tcan4x5x: Add suspend error handling
This commit adds error handling to tcan4x5x_suspend() by checking the
return value of m_can_class_suspend(). If the suspend fails, it restores
the IRQ wake state before returning the error.
> diff --git a/drivers/net/can/m_can/tcan4x5x-core.c b/drivers/net/can/m_can/tcan4x5x-core.c
> index a5b8829aa5193..b69312413d627 100644
> --- a/drivers/net/can/m_can/tcan4x5x-core.c
> +++ b/drivers/net/can/m_can/tcan4x5x-core.c
> @@ -575,11 +575,20 @@ static int __maybe_unused tcan4x5x_suspend(struct device *dev)
> {
> struct m_can_classdev *cdev = dev_get_drvdata(dev);
> struct spi_device *spi = to_spi_device(dev);
> + int ret;
>
> if (cdev->pm_wake_source)
> enable_irq_wake(spi->irq);
>
> - return m_can_class_suspend(dev);
> + ret = m_can_class_suspend(dev);
> + if (ret)
> + goto err_disable_irq;
> + return 0;
> +
> +err_disable_irq:
> + if (cdev->pm_wake_source)
> + disable_irq_wake(spi->irq);
[Severity: Low]
Will this trigger an unbalanced IRQ wake disable warning if
enable_irq_wake() fails?
The original code calls enable_irq_wake() but ignores its return value.
If the underlying IRQ controller does not support wake settings (e.g.
returning -ENXIO), wake_depth is not incremented.
If m_can_class_suspend() subsequently fails, the new error path calls
disable_irq_wake() unconditionally. If enable_irq_wake() had previously
failed, wouldn't this underflow wake_depth and trigger a WARN from the IRQ
core?
Could we check the return value of enable_irq_wake() and only call
disable_irq_wake() if it actually succeeded?
> + return ret;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261016-v7-3-topic-mcan-suspend-fix-fix-v2-0-7efa2b172cce@baylibre.com?part=2
prev parent reply other threads:[~2026-10-16 10:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 9:57 [PATCH v2 0/2] can: m_can: Fix suspend deinit() error path Markus Schneider-Pargmann (TI)
2026-10-16 9:57 ` [PATCH v2 1/2] " Markus Schneider-Pargmann (TI)
2026-10-16 10:13 ` sashiko-bot
2026-10-16 9:57 ` [PATCH v2 2/2] can: tcan4x5x: Add suspend error handling Markus Schneider-Pargmann
2026-10-16 10:04 ` Martin Hundebøll
2026-10-16 10:05 ` 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=sashiko-outbox-174121@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=mkl@pengutronix.de \
--cc=msp@baylibre.com \
--cc=o.rempel@pengutronix.de \
--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