linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] USB: of: filter disabled device node
@ 2025-11-22 11:25 Zhengqiao Xia
  2025-11-22 11:31 ` Greg KH
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Zhengqiao Xia @ 2025-11-22 11:25 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, linux-kernel, Zhengqiao Xia

We should not point the of_node of a USB device to a disabled devicetree
node. Otherwise, the interface under this USB device will not be able
to register.

Signed-off-by: Zhengqiao Xia <jerry.xzq@gmail.com>
---
 drivers/usb/core/of.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/core/of.c b/drivers/usb/core/of.c
index 763e4122ed5b3..6bb577e711811 100644
--- a/drivers/usb/core/of.c
+++ b/drivers/usb/core/of.c
@@ -31,6 +31,9 @@ struct device_node *usb_of_get_device_node(struct usb_device *hub, int port1)
 		if (of_property_read_u32(node, "reg", &reg))
 			continue;
 
+		if (!of_device_is_available(node))
+			continue;
+
 		if (reg == port1)
 			return node;
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread
* [PATCH] USB: of: filter disabled device node
@ 2025-11-21  8:09 Zhengqiao Xia
  2025-11-21  8:28 ` Greg KH
  0 siblings, 1 reply; 17+ messages in thread
From: Zhengqiao Xia @ 2025-11-21  8:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, linux-kernel, Zhengqiao Xia

We should not point the of_node of a USB device to a disabled devicetree
node. Otherwise, the interface under this USB device will not be able
to register.

Signed-off-by: Zhengqiao Xia <xiazhengqiao@huaqin.corp-partner.google.com>
---
 drivers/usb/core/of.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/core/of.c b/drivers/usb/core/of.c
index 763e4122ed5b3..6bb577e711811 100644
--- a/drivers/usb/core/of.c
+++ b/drivers/usb/core/of.c
@@ -31,6 +31,9 @@ struct device_node *usb_of_get_device_node(struct usb_device *hub, int port1)
 		if (of_property_read_u32(node, "reg", &reg))
 			continue;
 
+		if (!of_device_is_available(node))
+			continue;
+
 		if (reg == port1)
 			return node;
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2025-11-26 10:02 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-22 11:25 [PATCH] USB: of: filter disabled device node Zhengqiao Xia
2025-11-22 11:31 ` Greg KH
2025-11-22 11:32 ` Greg KH
2025-11-22 11:49   ` jerry xzq
2025-11-22 12:32     ` Greg KH
2025-11-22 12:54       ` jerry xzq
2025-11-22 11:32 ` Greg KH
     [not found] ` <CAD48c-UjbPK4GewGpVVdEY30fhnhdAGQqrXQ3r0RgHc6suMo7Q@mail.gmail.com>
2025-11-22 12:34   ` Greg KH
2025-11-22 13:15     ` jerry xzq
2025-11-24 14:22     ` Pin-yen Lin
2025-11-24 15:51       ` Greg KH
2025-11-25  9:44         ` Pin-yen Lin
2025-11-25 11:53           ` Greg KH
2025-11-26 10:02             ` Pin-yen Lin
  -- strict thread matches above, loose matches on Subject: below --
2025-11-21  8:09 Zhengqiao Xia
2025-11-21  8:28 ` Greg KH
     [not found]   ` <CADYyEwQqghzWedZYmZtwk1+R5DxMYg0aMJhVAutrW1w+CTB-7w@mail.gmail.com>
     [not found]     ` <2025112126-leverage-wrongful-85c4@gregkh>
2025-11-22 11:04       ` Zhengqiao Xia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).