From: sashiko-bot@kernel.org
To: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org,
media-ci@linuxtv.org, linux-clk@vger.kernel.org,
neil.armstrong@linaro.org, vkoul@kernel.org,
linux-phy@lists.infradead.org, robh@kernel.org,
olteanv@gmail.com
Subject: Re: [PATCH v14 2/4] phy: core: Add phy_get_by_of_node()
Date: Thu, 03 Sep 2026 23:11:12 +0000 [thread overview]
Message-ID: <20260903231112.651021F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260903-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v14-2-01ef1eced075@linaro.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The newly introduced `phy_get_by_of_node()` API misses the `usb-nop-xceiv` compatibility check, causing infinite probe deferrals instead of returning `-ENODEV` when called on a legacy USB PHY node.
--
commit 2369b98c7c0d0a704a02ff8f33a033c9c232ea8e
Author: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
phy: core: Add phy_get_by_of_node()
Add new function phy_get_by_of_node() allowing lookup of a phy by
device_node. Separates existing logic in _of_phy_get() into an internal
helper method _of_phy_get_with_args() to allow for reuse in new method.
> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> index cd9ace125567a..1d060bc22d02c 100644
> --- a/drivers/phy/phy-core.c
> +++ b/drivers/phy/phy-core.c
> @@ -604,22 +604,49 @@ int phy_validate(struct phy *phy, enum phy_mode mode, int submode,
> }
> EXPORT_SYMBOL_GPL(phy_validate);
>
> +/**
> + * _of_phy_get_with_args() - lookup and obtain a reference to a phy by of_phandle_args
> + * @args: of_phandle_args to the phy
> + *
> + * Returns the phy from the provider's of_xlate, -ENODEV if disabled,
> + * -EPROBE_DEFER if the provider is not yet registered.
> + */
> +static struct phy *_of_phy_get_with_args(struct of_phandle_args *args)
> +{
> + struct phy *phy;
> + struct phy_provider *phy_provider;
> +
> + phy_provider = of_phy_provider_lookup(args->np);
> + if (IS_ERR(phy_provider) || !try_module_get(phy_provider->owner))
> + return ERR_PTR(-EPROBE_DEFER);
[Severity: Medium]
Will this lookup always fail for usb-nop-xceiv PHYs, incorrectly triggering
the -EPROBE_DEFER return?
[ ... ]
> @@ -997,6 +1009,41 @@ struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np,
> }
> EXPORT_SYMBOL_GPL(devm_of_phy_get_by_index);
>
> +/**
> + * phy_get_by_of_node() - lookup and obtain a reference to a phy by device_node
> + * @np: node containing the phy
> + *
> + * Returns the phy associated with the device node or ERR_PTR.
> + */
> +struct phy *phy_get_by_of_node(struct device_node *np)
> +{
> + struct of_phandle_args args = { .np = np, .args_count = 0 };
> + struct phy *phy;
> +
> + if (!np)
> + return ERR_PTR(-EINVAL);
> +
> + mutex_lock(&phy_provider_mutex);
> +
> + phy = _of_phy_get_with_args(&args);
[Severity: Medium]
Does this call the helper without validating if the node represents a legacy
usb-nop-xceiv PHY?
In _of_phy_get(), there is a compatibility check for usb-nop-xceiv that
returns -ENODEV before calling the lookup logic. Because that check was
left in _of_phy_get() rather than being moved to the shared
_of_phy_get_with_args() helper, calling this new generic API on a legacy
USB PHY node will result in -EPROBE_DEFER instead of -ENODEV.
This might prevent drivers from falling back to the legacy USB PHY subsystem,
potentially causing infinite probe deferrals.
> +
> + if (IS_ERR(phy))
> + goto out_unlock;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v14-0-01ef1eced075@linaro.org?part=2
WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org,
media-ci@linuxtv.org, linux-clk@vger.kernel.org,
neil.armstrong@linaro.org, vkoul@kernel.org,
linux-phy@lists.infradead.org, robh@kernel.org,
olteanv@gmail.com
Subject: Re: [PATCH v14 2/4] phy: core: Add phy_get_by_of_node()
Date: Thu, 03 Sep 2026 23:11:12 +0000 [thread overview]
Message-ID: <20260903231112.651021F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260903-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v14-2-01ef1eced075@linaro.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The newly introduced `phy_get_by_of_node()` API misses the `usb-nop-xceiv` compatibility check, causing infinite probe deferrals instead of returning `-ENODEV` when called on a legacy USB PHY node.
--
commit 2369b98c7c0d0a704a02ff8f33a033c9c232ea8e
Author: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
phy: core: Add phy_get_by_of_node()
Add new function phy_get_by_of_node() allowing lookup of a phy by
device_node. Separates existing logic in _of_phy_get() into an internal
helper method _of_phy_get_with_args() to allow for reuse in new method.
> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> index cd9ace125567a..1d060bc22d02c 100644
> --- a/drivers/phy/phy-core.c
> +++ b/drivers/phy/phy-core.c
> @@ -604,22 +604,49 @@ int phy_validate(struct phy *phy, enum phy_mode mode, int submode,
> }
> EXPORT_SYMBOL_GPL(phy_validate);
>
> +/**
> + * _of_phy_get_with_args() - lookup and obtain a reference to a phy by of_phandle_args
> + * @args: of_phandle_args to the phy
> + *
> + * Returns the phy from the provider's of_xlate, -ENODEV if disabled,
> + * -EPROBE_DEFER if the provider is not yet registered.
> + */
> +static struct phy *_of_phy_get_with_args(struct of_phandle_args *args)
> +{
> + struct phy *phy;
> + struct phy_provider *phy_provider;
> +
> + phy_provider = of_phy_provider_lookup(args->np);
> + if (IS_ERR(phy_provider) || !try_module_get(phy_provider->owner))
> + return ERR_PTR(-EPROBE_DEFER);
[Severity: Medium]
Will this lookup always fail for usb-nop-xceiv PHYs, incorrectly triggering
the -EPROBE_DEFER return?
[ ... ]
> @@ -997,6 +1009,41 @@ struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np,
> }
> EXPORT_SYMBOL_GPL(devm_of_phy_get_by_index);
>
> +/**
> + * phy_get_by_of_node() - lookup and obtain a reference to a phy by device_node
> + * @np: node containing the phy
> + *
> + * Returns the phy associated with the device node or ERR_PTR.
> + */
> +struct phy *phy_get_by_of_node(struct device_node *np)
> +{
> + struct of_phandle_args args = { .np = np, .args_count = 0 };
> + struct phy *phy;
> +
> + if (!np)
> + return ERR_PTR(-EINVAL);
> +
> + mutex_lock(&phy_provider_mutex);
> +
> + phy = _of_phy_get_with_args(&args);
[Severity: Medium]
Does this call the helper without validating if the node represents a legacy
usb-nop-xceiv PHY?
In _of_phy_get(), there is a compatibility check for usb-nop-xceiv that
returns -ENODEV before calling the lookup logic. Because that check was
left in _of_phy_get() rather than being moved to the shared
_of_phy_get_with_args() helper, calling this new generic API on a legacy
USB PHY node will result in -EPROBE_DEFER instead of -ENODEV.
This might prevent drivers from falling back to the legacy USB PHY subsystem,
potentially causing infinite probe deferrals.
> +
> + if (IS_ERR(phy))
> + goto out_unlock;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v14-0-01ef1eced075@linaro.org?part=2
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2026-09-03 23:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 22:59 [PATCH v14 0/4] Add phy_get_by_of_node and devm helper Bryan O'Donoghue
2026-09-03 22:59 ` Bryan O'Donoghue
2026-09-03 22:59 ` [PATCH v14 1/4] phy: core: Fix use-after-free in phy_get paths Bryan O'Donoghue
2026-09-03 22:59 ` Bryan O'Donoghue
2026-09-04 7:45 ` Loic Poulain
2026-09-04 7:45 ` Loic Poulain
2026-09-04 9:41 ` Bryan O'Donoghue
2026-09-04 9:41 ` Bryan O'Donoghue
2026-09-04 12:39 ` Loic Poulain
2026-09-04 12:39 ` Loic Poulain
2026-09-03 22:59 ` [PATCH v14 2/4] phy: core: Add phy_get_by_of_node() Bryan O'Donoghue
2026-09-03 22:59 ` Bryan O'Donoghue
2026-09-03 23:11 ` sashiko-bot [this message]
2026-09-03 23:11 ` sashiko-bot
2026-09-03 22:59 ` [PATCH v14 3/4] phy: core: Add devm_phy_get_by_of_node() Bryan O'Donoghue
2026-09-03 22:59 ` Bryan O'Donoghue
2026-09-03 22:59 ` [PATCH v14 4/4] media: qcom: camss: Add support for PHY API devices Bryan O'Donoghue
2026-09-03 22:59 ` Bryan O'Donoghue
2026-09-03 23:14 ` sashiko-bot
2026-09-03 23:14 ` sashiko-bot
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=20260903231112.651021F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=media-ci@linuxtv.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
/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.