Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp31581rdb; Thu, 21 Dec 2023 01:45:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IETB8o0Od+Gmv6TNu2+MFStwEX0GoBtzDA2A8XFLphOavAFgDUvVQqA8r2QwVcThvfiLLd7 X-Received: by 2002:a17:902:c943:b0:1d3:b83c:9c3f with SMTP id i3-20020a170902c94300b001d3b83c9c3fmr5431249pla.70.1703151957698; Thu, 21 Dec 2023 01:45:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703151957; cv=none; d=google.com; s=arc-20160816; b=tg0mOKT/rWhxWbYpksXykSVNjFk/cPpkVM5q32gRHuKVMmCjEmKVLkBF/qjmJQuOOw 8dpHSYurcwLshwOKRxyv/vXwG0jvsrYgPmyRIyk+8raVVCAt9x7ZngJwYxYoyo2sKAkb 9+E+6SGAXkBnPdCcePaR1xgfTZsRBuySwi7dgGwQYRuKNguV56NztFh5k2UQKnnx/x59 ZfQ1z46/uZibvIPrD8ktYS1zZZb+IAUSUCRt7Iv3489WQ5gQtLx2SgZZuVKRtqh2CUg/ GwJHEk7eA0o+CYOLRDBaTSz7IM5N+TchApYOaZ9r2dBmhLUTkUSMVNXGTcJtqIYb/PkY Zx/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8Q5cOIVW2NXQCgE8m7MOSUxp7IMMRSApRmgjadLhzFs=; fh=HBBeGaII9b97mMkaSR1wakvpADQu95ul3UhvXwyaGoM=; b=BsaqOZMxyoU1wLvK62/EYrymK7y+DG+qpV96YbDP6vSScQjIdNys/3irbBQ/R/az/T z9c2+ZLuqPFhYm+5wnWibYlnU2AYAbbERYbc03JJLBvRzYmm1EeeCzzGN9yzdfg3M9Ns nJ65nZ2F+nJOQNrkEqUDjGEUAjhN72hr63EH5Jq+hGsiq6fGd1U7aFPGzDpUIYnJXW84 pm5uJVT5MxHfk2X2iCex9p/XZjIevx6YERfI7d3QK/vhHUKRdeCWMrqVMRbzthTOPqGP EAU0eI9bPOjXYs8wY794KVBq1k+P4Fo1o1ls6LV4Rp6gP5EMgUW57XSSllONAfQTywn+ SK4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=HGG1wa2r; spf=pass (google.com: domain of linux-kernel+bounces-8120-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8120-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id jj3-20020a170903048300b001d331f3e1e8si1160740plb.261.2023.12.21.01.45.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 01:45:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8120-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=HGG1wa2r; spf=pass (google.com: domain of linux-kernel+bounces-8120-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8120-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id CA2B5B232AC for ; Thu, 21 Dec 2023 09:31:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E6E14CDF4; Thu, 21 Dec 2023 09:27:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="HGG1wa2r" X-Original-To: linux-kernel@vger.kernel.org Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0FEC44D108; Thu, 21 Dec 2023 09:27:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=8Q5cOIVW2NXQCgE8m7MOSUxp7IMMRSApRmgjadLhzFs=; b=HGG1wa2raGGp05ho8o8RKqOknz KILTqZixOLLzlW1a6Z03U2rsSkmIsk7JIuRgI+NqiPxoYcBVRpxgdeLiYbBbxyAt0MoyPCTeDj6WD QpTNzCi+vTCe8a4ZECCa54w7drc3WtfQ5+bzb8g+u5Wd8ssmwJrO+OiPSAZ6JbRIKrRo=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rGFKu-003Uho-BE; Thu, 21 Dec 2023 10:27:24 +0100 Date: Thu, 21 Dec 2023 10:27:24 +0100 From: Andrew Lunn To: Ravi Gunasekaran Cc: =?utf-8?B?QXLEsW7DpyDDnE5BTA==?= , Daniel Golle , Landen Chao , DENG Qingfang , Sean Wang , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , David Bauer , mithat.guner@xeront.com, erkin.bozoglu@xeront.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH net-next] net: dsa: mt7530: register OF node for internal MDIO bus Message-ID: <8e248f59-007a-4c53-877f-6026f4a74d0b@lunn.ch> References: <20231220173539.59071-1-arinc.unal@arinc9.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: > > @@ -2177,7 +2180,9 @@ mt7530_setup_mdio(struct mt7530_priv *priv) > > if (priv->irq) > > mt7530_setup_mdio_irq(priv); > > > > - ret = devm_mdiobus_register(dev, bus); > > + mnp = of_get_child_by_name(np, "mdio"); > > If the node is not found, then the return value would be NULL. > Though devm_of_mdiobus_register() and of_node_put() take care of NULL references, > other drivers that use devm_of_mdiobus_register() mostly perform a early exit if the node is NULL. Actually, many don't as well. of_mdiobus_register() falls back to mdiobus_register() is np==NULL. That causes a scan of the bus to find all the PHYs and you can then use phy_find_first() to access them. So this code is O.K. Andrew