mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 4/9] phy: rockchip-inno-usb2: handle disabled child nodes gracefully
Date: Mon, 11 Oct 2021 10:03:41 +0200	[thread overview]
Message-ID: <20211011080346.37197-5-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20211011080346.37197-1-s.hauer@pengutronix.de>

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>
---
 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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  parent reply	other threads:[~2021-10-11  8:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11  8:03 [PATCH 0/9] RK3568 updates Sascha Hauer
2021-10-11  8:03 ` [PATCH 1/9] phy: rockchip: Add dummy driver for child node Sascha Hauer
2021-10-11  8:03 ` [PATCH 2/9] ARM: Rockchip rk3568 EVB: Enable deep probe Sascha Hauer
2021-10-11  8:03 ` [PATCH 3/9] ARM: Rockchip: rk3568 EVB: use 64bit partition sizes Sascha Hauer
2021-10-11  8:03 ` Sascha Hauer [this message]
2021-10-11  8:03 ` [PATCH 5/9] usb: dwc3: reset controller before using it Sascha Hauer
2021-10-11  8:03 ` [PATCH 6/9] usb: dwc3: Clarify error message Sascha Hauer
2021-10-11 17:43   ` Trent Piepho
2021-10-12  7:10     ` Sascha Hauer
2021-10-11  8:03 ` [PATCH 7/9] ARM: rk3568: Detect USB boot Sascha Hauer
2021-10-11 17:53   ` Trent Piepho
2021-10-12  7:15     ` Sascha Hauer
2021-10-11  8:03 ` [PATCH 8/9] cdev: Add function to get unallocated start of device Sascha Hauer
2021-10-11  8:03 ` [PATCH 9/9] ARM: Rockchip: RK3568: implement failsafe barebox update Sascha Hauer
2021-10-11  9:59   ` Michael Riesch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211011080346.37197-5-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox