From: Peng Fan <[email protected]> Switch to ofnode_parse_phandle() and add proper ofnode_valid() checks when resolving "phys" and "ti,ctrl_mod" references to avoid operating on invalid nodes.
No functional changes. Signed-off-by: Peng Fan <[email protected]> --- drivers/usb/musb-new/ti-musb.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c index 3dd6e3eb718..75568f54dce 100644 --- a/drivers/usb/musb-new/ti-musb.c +++ b/drivers/usb/musb-new/ti-musb.c @@ -88,8 +88,14 @@ static int ti_musb_of_to_plat(struct udevice *dev) if (!plat->base) return -EINVAL; - phys_node = ofnode_get_by_phandle(dev_read_u32_default(dev, "phys", 0)); - ctrl_mod_node = ofnode_get_by_phandle(ofnode_read_u32_default(phys_node, "ti,ctrl_mod", 0)); + phys_node = ofnode_parse_phandle(node, "phys", 0); + if (!ofnode_valid(phys_node)) + return -EINVAL; + + ctrl_mod_node = ofnode_parse_phandle(phys_node, "ti,ctrl_mod", 0); + if (!ofnode_valid(ctrl_mod_node)) + return -EINVAL; + plat->ctrl_mod_base = (void *)ofnode_get_addr(ctrl_mod_node); usb_index = ti_musb_get_usb_index(node); switch (usb_index) { -- 2.51.0

