[PATCH v16 1/6] phy: core: add notifier infrastructure

sashiko-bot at kernel.org sashiko-bot at kernel.org
Thu Sep 24 10:35:31 PDT 2026


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] phy: missing rollback mechanism on PRE_RESET notification failure
--

commit b2bd6d1e7b7d0d73d320775ff3e7dee092787ebc
Author: Sebastian Reichel <sebastian.reichel at collabora.com>

phy: core: add notifier infrastructure

This commit introduces a new PHY notifier API that allows consumer drivers
to hook into reset events from a PHY device. This helps gracefully handle
configuration or cable orientation changes.

> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> index 21aaf2f76e53e..51d261daae7a9 100644
> --- a/drivers/phy/phy-core.c
> +++ b/drivers/phy/phy-core.c

[ ... ]

> @@ -542,6 +542,70 @@ int phy_notify_state(struct phy *phy, union phy_notify state)

[ ... ]

> +int phy_notify_reset(struct phy *phy, enum phy_notification event)
> +{
> +	int ret;
> +
> +	if (!phy)
> +		return 0;
> +
> +	ret = blocking_notifier_call_chain(&phy->notifier, event, phy);
> +	return notifier_to_errno(ret);

[Severity: Medium]
What happens if one of the consumers in the notifier chain returns an error
during a PHY_NOTIFY_PRE_RESET event?

If a PHY has multiple consumers registered to its notifier chain, and the
first consumer successfully processes the PRE_RESET event but a subsequent
consumer returns an error (such as NOTIFY_BAD), the notification chain will
abort and the provider will receive the error.

This stops the notification chain on the first error, which could leave the
already-notified consumers permanently stranded in a quiesced state since
the reset is aborted without sending a POST_RESET or ABORT_RESET.

Would it be safer to use blocking_notifier_call_chain_robust() here
instead, and introduce a PHY_NOTIFY_ABORT_RESET event to allow previously
notified consumers to roll back their state?

> +}
> +EXPORT_SYMBOL_GPL(phy_notify_reset);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260924-b4-rockchip-dwc3-rockchip-glue-v16-0-126a2e9133c3@collabora.com?part=1



More information about the linux-phy mailing list