Skip to content
Commit 14639bf1 authored by Jonas Karlman's avatar Jonas Karlman Committed by Tom Rini
Browse files

phy: Set phy->dev to NULL when generic_phy_get_by_index_nodev() fails



Generic phy helpers typically use generic_phy_valid() to determine if
the helper should perform its function on a passed struct phy.
generic_phy_valid() treat any struct phy having phy->dev set as valid.

With generic_phy_get_by_index_nodev() setting phy->dev to a valid struct
udevice early, there can be situations where the struct phy is returned
as valid when initialization in fact failed and returned an error.

Fix this by setting phy->dev back to NULL when any of the calls to
of_xlate ops, device_get_supply_regulator or phy_alloc_counts fail. Also
extend the dm_test_phy_base test with a test where of_xlate ops fail.

Fixes: 72e5016f ("drivers: phy: add generic PHY framework")
Fixes: b9688df3 ("drivers: phy: Set phy->dev to NULL when generic_phy_get_by_index() fails")
Signed-off-by: default avatarJonas Karlman <jonas@kwiboo.se>
parent feb4b919
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment