Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Christian Marangi" <ansuelsmth@gmail.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH net-next v15 03/12] net: pcs: implement Firmware node support for PCS driver
Date: Wed, 02 Sep 2026 08:30:56 +0000	[thread overview]
Message-ID: <20260902083056.7703C1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260901083001.8044-4-ansuelsmth@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Provider xlate errors are improperly masked to -ENODEV, breaking error reporting.
--

commit bda5aa3be050e19dfc3117135971734f3811b538
Author: Christian Marangi <ansuelsmth@gmail.com>

net: pcs: implement Firmware node support for PCS driver

This commit implements the foundation for firmware node support for PCS drivers.
It introduces an API for PCS drivers to add providers and for consumers to
retrieve a PCS by passing a firmware node pointer and an index.

> diff --git a/drivers/net/pcs/pcs.c b/drivers/net/pcs/pcs.c
> new file mode 100644
> index 0000000000000..39550d9a12a2a
> --- /dev/null
> +++ b/drivers/net/pcs/pcs.c
> @@ -0,0 +1,245 @@
[ ... ]
> +static struct phylink_pcs *
> +fwnode_pcs_get_from_pcsspec(struct fwnode_reference_args *pcsspec)
> +{
> +	struct fwnode_pcs_provider *provider;
> +	struct phylink_pcs *pcs = NULL;
> +
> +	if (!pcsspec)
> +		return ERR_PTR(-EINVAL);
> +
> +	mutex_lock(&fwnode_pcs_mutex);
> +	list_for_each_entry(provider, &fwnode_pcs_providers, link) {
> +		pcs = __fwnode_pcs_get_from_pcsspec_provider(pcsspec, provider);
> +		if (!IS_ERR(pcs))
> +			break;
> +	}

[Severity: Medium]
What happens if a matching provider's xlate function legitimately returns
an error?

Looking at __fwnode_pcs_get_from_pcsspec_provider(), it returns -EINVAL
when the firmware node does not match. Because of this, checking
!IS_ERR(pcs) successfully skips non-matching providers.

However, if a provider does match but its xlate callback returns an error
(like -EINVAL or -EPROBE_DEFER), pcs will also be an error pointer. This
causes the loop to incorrectly continue searching instead of stopping at
the matching provider.

> +	mutex_unlock(&fwnode_pcs_mutex);
> +
> +	return !IS_ERR_OR_NULL(pcs) ? pcs : ERR_PTR(-ENODEV);

[Severity: Medium]
Does this unconditionally overwrite the error code from the xlate callback?

Because the loop does not break on xlate errors, any specific error code
returned by the provider is discarded. Even if the matching provider was
the last one in the list, its error pointer is replaced with -ENODEV here.

This causes fwnode_phylink_pcs_parse() to silently skip the PCS (treating
it as an unprobed/late PCS) instead of propagating the actual error.
Returning the actual error pointer could allow the caller to handle it
appropriately.

> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260901083001.8044-1-ansuelsmth@gmail.com?part=3

  reply	other threads:[~2026-09-02  8:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  8:29 [PATCH net-next v15 00/12] net: pcs: Introduce support for fwnode PCS Christian Marangi
2026-09-01  8:29 ` [PATCH net-next v15 01/12] net: phylink: keep and use MAC supported_interfaces in phylink struct Christian Marangi
2026-09-02  8:30   ` sashiko-bot
2026-09-01  8:29 ` [PATCH net-next v15 02/12] net: phylink: introduce internal phylink PCS handling Christian Marangi
2026-09-02  8:30   ` sashiko-bot
2026-09-01  8:29 ` [PATCH net-next v15 03/12] net: pcs: implement Firmware node support for PCS driver Christian Marangi
2026-09-02  8:30   ` sashiko-bot [this message]
2026-09-01  8:29 ` [PATCH net-next v15 04/12] net: phylink: save phylink instance fwnode on phylink_create Christian Marangi
2026-09-01  8:29 ` [PATCH net-next v15 05/12] net: phylink: support PCS provider release Christian Marangi
2026-09-02  8:30   ` sashiko-bot
2026-09-01  8:29 ` [PATCH net-next v15 06/12] net: phylink: support late PCS provider attach Christian Marangi
2026-09-02  8:30   ` sashiko-bot
2026-09-01  8:29 ` [PATCH net-next v15 07/12] net: Document PCS subsystem Christian Marangi
2026-09-01  8:29 ` [PATCH net-next v15 08/12] MAINTAINERS: add myself as PCS subsystem maintainer Christian Marangi
2026-09-01  8:29 ` [PATCH net-next v15 09/12] net: phylink: add .pcs_link_down PCS OP Christian Marangi
2026-09-01  8:29 ` [PATCH net-next v15 10/12] dt-bindings: net: pcs: Document support for Airoha Ethernet PCS Christian Marangi
2026-09-01  8:29 ` [PATCH net-next v15 11/12] net: pcs: airoha: add PCS driver for Airoha AN7581 SoC Christian Marangi
2026-09-02  8:30   ` sashiko-bot
2026-09-01  8:29 ` [PATCH net-next v15 12/12] net: airoha: add phylink support Christian Marangi
2026-09-01  9:05   ` Lorenzo Bianconi

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=20260902083056.7703C1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ansuelsmth@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox