Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8606521ybn; Tue, 1 Oct 2019 10:28:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkWFGCYt9KoQa8XqMotZPlXj7AHnOxdOcgKyUdujheDSo1U5u3fJoBAoGfhCjqKEti+tj9 X-Received: by 2002:a05:6402:184d:: with SMTP id v13mr27519511edy.56.1569950911454; Tue, 01 Oct 2019 10:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569950911; cv=none; d=google.com; s=arc-20160816; b=GlTA8xPsNXeD34RUNt5Wro8DTadLhV55v8YPiwbWFlZ7jo81M2X2PQwfe9chlnkX/B iQxCivda51iVql4IrP7BNpkChATUY4K5G4uhS051cj2b8juaV3l3TnB2ti32Yn9xh3Im pBTneFRsEt5IvTo//U69QvV9MRs0B21sEAkPlesL6oglv9urJP/j2nbP5/iucQsVrZy3 4pervN8g39JnGNFNDFMgQAcCyTN7aZM7LfxLR3AksYNl0L3tMKnprIvGh0LQ/bCtaelH wkAw0QJ2HTumT/jWH5UiqLTUB0uHdkGfeTsqRih4Key9l13eP+FJl9js7iDVvlLJGz7E QmoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=B5zvMkSCXB5ogP9hb/pdx38q7fdLUeclRqAiYzH/G6Q=; b=NdKbSGwZUxHF+UOSkU75M90cPJ72/YT3MrgtbtOIWBOI96ier+e4P7V4VvG81z7Us6 Iu19RQYWdvkHygSx5XnCly7d1B5Eak523BU6FKNo8UNWlO7BVS02U9oRRW3yay5K1WyD hz49ETgfh3lgOtq/37bFB+Qn6vrHeaa4UI9q+fde7MS5oux3sPJJEwLWTicNusPDOaqD etf9MB5aArTavklld696372KqPWXHGLMdaJVMOMg723AhK2coSRhtIuwdWWxKPKri+2m JTaPY6kauQbxGvT9kpUlohi5+6OL3OdpqqhsmWeRGhEtX6ZvNdP4Hb4eaW8Jo8Jxp8gb fwwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z10si9350836ejx.236.2019.10.01.10.28.07; Tue, 01 Oct 2019 10:28:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730534AbfJAR15 (ORCPT + 99 others); Tue, 1 Oct 2019 13:27:57 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:50468 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730447AbfJAR14 (ORCPT ); Tue, 1 Oct 2019 13:27:56 -0400 Received: from localhost (unknown [IPv6:2601:601:9f00:1e2::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 3A388154F3255; Tue, 1 Oct 2019 10:27:56 -0700 (PDT) Date: Tue, 01 Oct 2019 10:27:55 -0700 (PDT) Message-Id: <20191001.102755.1421638394065642330.davem@davemloft.net> To: andrew@lunn.ch Cc: o.rempel@pengutronix.de, jcliburn@gmail.com, chris.snook@gmail.com, kernel@pengutronix.de, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net v2] net: ag71xx: fix mdio subnode support From: David Miller In-Reply-To: <20191001164340.GC2031@lunn.ch> References: <20191001064147.23633-1-o.rempel@pengutronix.de> <20191001.090320.1192378852987776883.davem@davemloft.net> <20191001164340.GC2031@lunn.ch> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Tue, 01 Oct 2019 10:27:56 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrew Lunn Date: Tue, 1 Oct 2019 18:43:40 +0200 > On Tue, Oct 01, 2019 at 09:03:20AM -0700, David Miller wrote: >> From: Oleksij Rempel >> Date: Tue, 1 Oct 2019 08:41:47 +0200 >> >> > @@ -571,7 +571,9 @@ static int ag71xx_mdio_probe(struct ag71xx *ag) >> > msleep(200); >> > } >> > >> > - err = of_mdiobus_register(mii_bus, np); >> > + mnp = of_get_child_by_name(np, "mdio"); >> > + err = of_mdiobus_register(mii_bus, mnp); >> >> of_get_child_by_name() can fail, so error checking is necessary >> before you pass mnp into of_mdiobus_register(). > > Hi David > > /** > * of_get_child_by_name - Find the child node by name for a given parent > * @node: parent node > * @name: child name to look for. > * > * This function looks for child node for given matching name > * > * Returns a node pointer if found, with refcount incremented, use > * of_node_put() on it when done. > * Returns NULL if node is not found. > */ > > So on error, it returns NULL. And passing NULL to > of_mdiobus_register() is the correct thing to do if there is no DT > node. of_node_put() is also O.K. with NULL. > > So this is all O.K. as is. > > Reviewed-by: Andrew Lunn Aha I didn't think about it that way... Ok I'll apply this thanks.