mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Wenyuan Li <2063309626@qq.com>,
	linux-can@vger.kernel.org, Marc Kleine-Budde <mkl@pengutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org,
	Alban Bedel <alban.bedel@lht.dlh.de>,
	Bartosz Golaszewski <brgl@kernel.org>,
	gszhai@bjtu.edu.cn, Jakub Kicinski <kuba@kernel.org>,
	Marco Crivellari <marco.crivellari@suse.com>,
	Maud Spierings <maudspierings@gocontroll.com>,
	Vincent Mailhol <mailhol@kernel.org>,
	23120469@bjtu.edu.cn, 25125332@bjtu.edu.cn, 25125283@bjtu.edu.cn
Subject: Re: [PATCH] can: mcp251x: add error handling for power enable in open and resume
Date: Wed, 11 Mar 2026 19:05:20 +0100	[thread overview]
Message-ID: <c032450b-8249-4415-b0e5-cc3e2c863120@web.de> (raw)
In-Reply-To: <tencent_6A462B2C8A50BA55116D560D2FFE9EED2D09@qq.com>

> Add missing error handling for mcp251x_power_enable() calls in both
> mcp251x_open() and mcp251x_can_resume() functions.
…
> In mcp251x_can_resume(), if power enable fails during system resume,
> propagate the error to PM framework and log the error with dev_err()
> for debugging.
…

How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?


…
> @@ -1516,11 +1521,23 @@ static int __maybe_unused mcp251x_can_resume(struct device *dev)
>  {
>  	struct spi_device *spi = to_spi_device(dev);
>  	struct mcp251x_priv *priv = spi_get_drvdata(spi);
> +	int ret = 0;

How do you think about to use the return value at an other place
(at the end)?


>  
> -	if (priv->after_suspend & AFTER_SUSPEND_POWER)
> -		mcp251x_power_enable(priv->power, 1);
> -	if (priv->after_suspend & AFTER_SUSPEND_UP)
> -		mcp251x_power_enable(priv->transceiver, 1);
…
> +	if (priv->after_suspend & AFTER_SUSPEND_UP) {
> +		ret = mcp251x_power_enable(priv->power, 1);
> +		if (ret) {
> +			dev_err(dev, "Failed to restore power: %d\n", ret);
> +			goto out;
> +		}
> +	}
>  
>  	if (priv->after_suspend & (AFTER_SUSPEND_POWER | AFTER_SUSPEND_UP))
>  		queue_work(priv->wq, &priv->restart_work);
> @@ -1529,6 +1546,7 @@ static int __maybe_unused mcp251x_can_resume(struct device *dev)
>  
>  	priv->force_quit = 0;
>  	enable_irq(spi->irq);
> +out:
>  	return 0;
> }

Would you like to avoid duplicate source code here?

Regards,
Markus

  reply	other threads:[~2026-03-11 18:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11 15:50 Wenyuan Li
2026-03-11 18:05 ` Markus Elfring [this message]
2026-03-12  7:46 ` Marc Kleine-Budde
2026-03-12 12:48   ` [PATCH V2] can: mcp251x: add error handling for power enable inopen " 悬溺
2026-03-12 13:01     ` Marc Kleine-Budde

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=c032450b-8249-4415-b0e5-cc3e2c863120@web.de \
    --to=markus.elfring@web.de \
    --cc=2063309626@qq.com \
    --cc=23120469@bjtu.edu.cn \
    --cc=25125283@bjtu.edu.cn \
    --cc=25125332@bjtu.edu.cn \
    --cc=alban.bedel@lht.dlh.de \
    --cc=brgl@kernel.org \
    --cc=gszhai@bjtu.edu.cn \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mailhol@kernel.org \
    --cc=marco.crivellari@suse.com \
    --cc=maudspierings@gocontroll.com \
    --cc=mkl@pengutronix.de \
    /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®