diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2021-10-12 09:33:48 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-10-12 10:22:08 +0200 |
commit | 7aabb508bc3e2d507b6b4bee18be6f53d32dc2e1 (patch) | |
tree | 507472d992325fc417ded537c91e57132f1fd7a6 | |
parent | 6668748f7b0c77e5c5549217c08c9429a5631ddb (diff) | |
download | barebox-7aabb508bc3e2d507b6b4bee18be6f53d32dc2e1.tar.gz barebox-7aabb508bc3e2d507b6b4bee18be6f53d32dc2e1.tar.xz |
phy: rockchip-inno-usb2: handle disabled child nodes gracefully
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@pengutronix.de>
Link: https://lore.barebox.org/20211012073352.4071559-5-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 6 |
1 files changed, 6 insertions, 0 deletions
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); |