]> git.dujemihanovic.xyz Git - u-boot.git/commit
phy: Set phy->dev to NULL when generic_phy_get_by_name() fails
authorJonas Karlman <jonas@kwiboo.se>
Thu, 31 Aug 2023 22:16:33 +0000 (22:16 +0000)
committerTom Rini <trini@konsulko.com>
Wed, 13 Sep 2023 19:52:20 +0000 (15:52 -0400)
commitfeb4b919abf39f39faf660ef3d9aedebb54f5db5
treebcdfdcb2064cbe5c297d5d37e654b8fe495c317b
parentcba79a1b2e1155eb69802cc9a8e7d1d856237f67
phy: Set phy->dev to NULL when generic_phy_get_by_name() fails

generic_phy_get_by_name() does not initialize phy->dev to NULL before
returning when dev_read_stringlist_search() fails. This can lead to an
uninitialized or reused struct phy erroneously be report as valid by
generic_phy_valid().

Fix this issue by initializing phy->dev to NULL, also extend the
dm_test_phy_base test with calls to generic_phy_valid().

Fixes: b9688df3cbf4 ("drivers: phy: Set phy->dev to NULL when generic_phy_get_by_index() fails")
Fixes: 868d58f69c7c ("usb: dwc3: Fix non-usb3 configurations")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
drivers/phy/phy-uclass.c
test/dm/phy.c