[PATCH 4/9] phy: rockchip-inno-usb2: handle disabled child nodes gracefully
Sascha Hauer
s.hauer at pengutronix.de
Mon Oct 11 01:03:41 PDT 2021
When child nodes of the phy node are disabled then
of_platform_device_create() on them returns a NULL pointer. Make sure we
skip initialization for these disabled nodes and also skip them when
iterating over them in the xlate function.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index 37c2ae1d16..6b9d54f344 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -264,6 +264,9 @@ static struct phy *rockchip_usb2phy_of_xlate(struct device_d *dev,
int port;
for (port = 0; port < 2; port++) {
+ if (!rphy->phys[port].phy)
+ continue;
+
if (phynode == rphy->phys[port].phy->dev.device_node) {
p = &rphy->phys[port];
return p->phy;
@@ -438,6 +441,9 @@ static int rockchip_usb2phy_probe(struct device_d *dev)
return -EINVAL;
phydev = of_platform_device_create(child, dev);
+ if (!phydev)
+ continue;
+
of_platform_device_dummy_drv(phydev);
phy = phy_create(phydev, child, &rockchip_usb2phy_ops);
--
2.30.2
More information about the barebox
mailing list