From patchwork Fri Mar 1 11:05:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 10834973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C00321880 for ; Fri, 1 Mar 2019 11:06:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B08D02EE5C for ; Fri, 1 Mar 2019 11:06:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A451A2EE60; Fri, 1 Mar 2019 11:06:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6365A2EE5C for ; Fri, 1 Mar 2019 11:06:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728347AbfCALGs (ORCPT ); Fri, 1 Mar 2019 06:06:48 -0500 Received: from relmlor2.renesas.com ([210.160.252.172]:42831 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727932AbfCALGs (ORCPT ); Fri, 1 Mar 2019 06:06:48 -0500 X-IronPort-AV: E=Sophos;i="5.58,427,1544454000"; d="scan'208";a="9011079" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Mar 2019 20:06:46 +0900 Received: from fabrizio-dev.ree.adwin.renesas.com (unknown [10.226.36.184]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 80BFB4377B77; Fri, 1 Mar 2019 20:06:43 +0900 (JST) From: Fabrizio Castro To: Greg Kroah-Hartman , Geert Uytterhoeven , Yoshihiro Shimoda Cc: Fabrizio Castro , Arnd Bergmann , linux-usb@vger.kernel.org, Simon Horman , Chris Paterson , Biju Das , linux-renesas-soc@vger.kernel.org, stable@vger.kernel.org, #@vger.kernel.org, v4.4+@vger.kernel.org Subject: [PATCH 1/4] usb: common: Consider only available nodes for dr_mode Date: Fri, 1 Mar 2019 11:05:45 +0000 Message-Id: <1551438348-22119-2-git-send-email-fabrizio.castro@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1551438348-22119-1-git-send-email-fabrizio.castro@bp.renesas.com> References: <1551438348-22119-1-git-send-email-fabrizio.castro@bp.renesas.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Yoshihiro Shimoda --- drivers/usb/common/common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index 48277bb..73c8e65 100644 --- a/drivers/usb/common/common.c +++ b/drivers/usb/common/common.c @@ -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) {