From patchwork Mon Apr 26 12:31:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1470275 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=Zq34EZEo; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FTPSZ3V16z9sWH for ; Mon, 26 Apr 2021 22:33:18 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A581B82CAE; Mon, 26 Apr 2021 14:32:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="Zq34EZEo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 034F882B92; Mon, 26 Apr 2021 14:31:46 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 75F9E82057 for ; Mon, 26 Apr 2021 14:31:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ej1-x62e.google.com with SMTP id r9so84170347ejj.3 for ; Mon, 26 Apr 2021 05:31:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3i02dMcFOECnndQlhBNxsqqEznccXCoiWulBf8ypfDk=; b=Zq34EZEouBjz8+5IAXvfesbBR5hQsV5YgtBLiQJX/xBBBRCC4iI9aRpv1wQOPuXDnY 6ikUVc9zxlRMDRWytZXJrQFIlj710K5rW4NVpMN7v2qZMbLJ5Dl2Tb4jLEOz8Ug87rps iCdZluOAuJBrXCkHFZIJbUn9Ll0HmQDm1nXkfuVy01SM+60SGbW/SDnmLjGv6OsHJXUc WqwkB9khKmMS9ze6FgvRudOrJsgQ7SNd/9pFWdOxwhEOwnyXQXSoD6m0pFJrMhVBxgE4 cA28vY29a3jm9a4oNlo/PbJsQFyL8mo2kSDdEty6IVqvzkzWcCMEOUNHoIDDJ2pOzT15 zIUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=3i02dMcFOECnndQlhBNxsqqEznccXCoiWulBf8ypfDk=; b=gToH3nJ+r/G9pt/lmQrrdpwnO8aFmZpKFmajfxGDoFlGYLsTJjnar7rXOzPJMTClvN XXRpSaw6uNuPCg1Sau/M3O1KoaAVNJAdHXI9CpCwnEzEgSWvkKhghjn5DE1aItraZG/R ZFGmYC/pEI89ZtlROu13msy0kD0Bc695DK2zRN4bJrYqyeGpwyqNLCf13RqSb5hIKMMo IYK1tILlvvSokdJnTpCPzgyaen8T3W6NKwRXeW3MjsEdLdLvLZOI+ZFh9Qbb4wE5a+0k DvWcixev0JSuvsRMk5Ocp2JZMkIcZ8eDwqfId/eEFckE5UvrImcbGxzwsJc08d4iHvTF K5zQ== X-Gm-Message-State: AOAM533JIH818lV71Q10eADC9GuqXXXoaMcIiMh9rmFZs415S20S44U4 E8UyLvZzJJjisamdye5ivIw1EqMYqMYAQy6U X-Google-Smtp-Source: ABdhPJw4yUIgUdSBZWffNZn1sCoUjiRrF5cFmQPGNONoyh+ByclaG+Al5S5cOzctzd9LmV8+ooC4bA== X-Received: by 2002:a17:906:88b:: with SMTP id n11mr17779354eje.26.1619440299885; Mon, 26 Apr 2021 05:31:39 -0700 (PDT) Received: from localhost ([2a02:768:2307:40d6::45a]) by smtp.gmail.com with ESMTPSA id s9sm13518494edd.16.2021.04.26.05.31.39 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Apr 2021 05:31:39 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com, bmeng.cn@gmail.com, priyanka.jain@nxp.com Cc: Florin Chiculita , Joe Hershberger , Ramon Fried , Simon Glass , Vladimir Oltean Subject: [PATCH] net: phy: xilinx: Break while loop over ethernet phy Date: Mon, 26 Apr 2021 14:31:38 +0200 Message-Id: <4aaa550bcc9566e14716309e3bf2c04f9c100b1d.1619440296.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean The commit 6c993815bbea ("net: phy: xilinx: Be compatible with live OF tree") change driver behavior to while loop which wasn't correct because the driver was looping over again and again. The reason was that ofnode_valid() is taking 0 as correct value. Fix it by changing while loop to ofnode_for_each_subnode() which is only loop over available nodes. Fixes: 6c993815bbea ("net: phy: xilinx: Be compatible with live OF tree") Signed-off-by: Michal Simek Reviewed-by: Bin Meng --- drivers/net/phy/phy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index dcdef9e661d6..ed197fa46d73 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -948,9 +948,9 @@ static struct phy_device *phy_connect_gmii2rgmii(struct mii_dev *bus, phy_interface_t interface) { struct phy_device *phydev = NULL; - ofnode node = dev_ofnode(dev); + ofnode node; - while (ofnode_valid(node)) { + ofnode_for_each_subnode(node, dev_ofnode(dev)) { node = ofnode_by_compatible(node, "xlnx,gmii-to-rgmii-1.0"); if (ofnode_valid(node)) { phydev = phy_device_create(bus, 0,