usb: common: Consider only available nodes for dr_mode
authorFabrizio Castro <fabrizio.castro@bp.renesas.com>
Fri, 1 Mar 2019 11:05:45 +0000 (11:05 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Mar 2019 13:57:32 +0000 (14:57 +0100)
There are cases where multiple device tree nodes point to the
same phy node by means of the "phys" property, but we should
only consider those nodes that are marked as available rather
than just any node.

Fixes: 98bfb3946695 ("usb: of: add an api to get dr_mode by the phy node")
Cc: stable@vger.kernel.org # v4.4+
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/common/common.c

index 48277bbc15e4d155fc9c1c7315fcf57d6347b51e..73c8e65917461f8f83d9233c96bdf0d2b8956b27 100644 (file)
@@ -145,6 +145,8 @@ enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *np, int arg0)
 
        do {
                controller = of_find_node_with_property(controller, "phys");
+               if (!of_device_is_available(controller))
+                       continue;
                index = 0;
                do {
                        if (arg0 == -1) {