All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alessandro Zini" <alessandro.zini@siemens.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH net-next v2 2/2] net: ethernet: oa_tc6: add reset-gpios support
Date: Thu, 17 Sep 2026 07:54:15 +0000	[thread overview]
Message-ID: <20260917075416.1C7491F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260916075349.21822-3-alessandro.zini@siemens.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] net: oa_tc6: probe deferral broken by swallowed devm_gpiod_get_optional error
--

commit 68c336e363623d8a5b0d1022273415e9f9d3b4a9
Author: Alessandro Zini <alessandro.zini@siemens.com>

net: ethernet: oa_tc6: add reset-gpios support

Adds support for an optional reset GPIO in oa_tc6_init(). Asserts the hardware
reset line if the GPIO is specified in the device tree.

> diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c
> index 6fcc5f561d560..a697e2cb99cd8 100644
> --- a/drivers/net/ethernet/oa_tc6.c
> +++ b/drivers/net/ethernet/oa_tc6.c

[ ... ]

> @@ -1503,6 +1506,24 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev,
>  	if (!tc6->spi_data_rx_buf)
>  		return NULL;
>  
> +	tc6->reset_gpio = devm_gpiod_get_optional(&spi->dev, "reset",
> +						  GPIOD_OUT_LOW);
> +	if (IS_ERR(tc6->reset_gpio)) {
> +		dev_err_probe(&spi->dev, PTR_ERR(tc6->reset_gpio),
> +			      "Failed to get reset GPIO\n");
> +		return NULL;

[Severity: High]
Does returning NULL here break probe deferral?

If devm_gpiod_get_optional() returns ERR_PTR(-EPROBE_DEFER) because the GPIO
provider is not yet ready, dev_err_probe() catches and logs it. However, this
function then ignores the error code and unconditionally returns NULL.

Callers of oa_tc6_init() (like lan865x_probe()) treat a NULL return as a
permanent failure and return -ENODEV:

drivers/net/ethernet/microchip/lan865x/lan865x.c:lan865x_probe() {
    ...
	priv->tc6 = oa_tc6_init(spi, netdev, NULL);
	if (!priv->tc6) {
		ret = -ENODEV;
		goto free_netdev;
	}
    ...
}

This converts a retryable -EPROBE_DEFER into a fatal -ENODEV, causing a
permanent initialization failure if the GPIO driver loads after the SPI driver.

Should oa_tc6_init() return an ERR_PTR() instead of NULL on failure, so that
callers can propagate the exact error code?

> +	}
> +
> +	if (tc6->reset_gpio) {
> +		/* Assert hardware reset for 10 us (datasheet specifies min 5 us)
> +		 * and allow 1 ms settle time for crystal oscillator startup.
> +		 */
> +		gpiod_set_value_cansleep(tc6->reset_gpio, 1);
> +		fsleep(10);
> +		gpiod_set_value_cansleep(tc6->reset_gpio, 0);
> +		fsleep(1000);
> +	}
> +
>  	/* Check the PROTE bit status so that we can reset the device */
>  	ret = oa_tc6_check_ctrl_protection(tc6);
>  	if (ret) {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916075349.21822-1-alessandro.zini@siemens.com?part=2

  parent reply	other threads:[~2026-09-17  7:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16  7:53 [PATCH net-next v2 0/2] net: ethernet: oa_tc6: add reset-gpios support Alessandro Zini
2026-09-16  7:53 ` [PATCH net-next v2 1/2] dt-bindings: net: microchip,lan8650: add reset-gpios property Alessandro Zini
2026-09-18  9:43   ` Krzysztof Kozlowski
2026-09-16  7:53 ` [PATCH net-next v2 2/2] net: ethernet: oa_tc6: add reset-gpios support Alessandro Zini
2026-09-16  8:40   ` Qingfang Deng
2026-09-17  7:54   ` sashiko-bot [this message]
2026-09-17  8:45   ` 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=20260917075416.1C7491F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alessandro.zini@siemens.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.