From: "Markus Schneider-Pargmann" <msp@baylibre.com>
To: "Martin Hundebøll" <martin@geanix.com>,
"Markus Schneider-Pargmann" <msp@baylibre.com>,
"Marc Kleine-Budde" <mkl@pengutronix.de>,
"Vincent Mailhol" <mailhol@kernel.org>,
"Sean Nyekjaer" <sean@geanix.com>
Cc: "Kendall Willis" <k-willis@ti.com>, <linux-can@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] can: tcan4x5x: Add suspend error handling
Date: Wed, 04 Nov 2026 12:12:04 +0100 [thread overview]
Message-ID: <DMMDQQGAJSRP.2RFOOW1YOKT8F@baylibre.com> (raw)
In-Reply-To: <9aba5682e371f5969d3ddca1c6a763485bc25285.camel@geanix.com>
[-- Attachment #1: Type: text/plain, Size: 1364 bytes --]
Hi Martin,
On Fri Oct 16, 2026 at 12:04 PM CEST, Martin Hundebøll wrote:
> Hi Markus,
>
> On Fri, 2026-10-16 at 11:57 +0200, Markus Schneider-Pargmann wrote:
>> diff --git a/drivers/net/can/m_can/tcan4x5x-core.c
>> b/drivers/net/can/m_can/tcan4x5x-core.c
>> index a5b8829aa519..b69312413d62 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);
>> + return ret;
>
> Wouldn't this be better written in the shorter form:
>
> ret = m_can_class_suspend(dev);
> if (ret && dev->pm_wake_source)
> disable_irq_wake(spi->irq);
>
> return ret;
>
> ?
Thanks for your review. I personally prefer the variant with a goto. It
is not as compact but it is extendable if this function needs another
instruction with error handling at some point.
Best
Markus
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 289 bytes --]
next prev parent reply other threads:[~2026-11-04 11:12 UTC|newest]
Thread overview: 7+ 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-18 1:22 ` netdev-bot+sashiko
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-11-04 11:12 ` Markus Schneider-Pargmann [this message]
2026-10-18 1:22 ` 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=DMMDQQGAJSRP.2RFOOW1YOKT8F@baylibre.com \
--to=msp@baylibre.com \
--cc=k-willis@ti.com \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=martin@geanix.com \
--cc=mkl@pengutronix.de \
--cc=sean@geanix.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
all inboxes | Powered by JetHome®