Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8569330ybn; Tue, 1 Oct 2019 09:57:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwBcZOj3BvIA0cT3h6OgCXmbDLanNSZFSfn6DUruMqKdhyrp9BLYD8yZW+W8InOy5wqnbxo X-Received: by 2002:aa7:c2ce:: with SMTP id m14mr26926236edp.191.1569949061887; Tue, 01 Oct 2019 09:57:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569949061; cv=none; d=google.com; s=arc-20160816; b=xDtCjlo+4ttzRbtl8exhTu3TKl+lW7ZcbbBQvakg4HSTFKHet3WO7RE7184BFgp5qe o4pT9RnKopdrFUt40cCgDbNeMsIn942nkh3jMl3DCXXzXzErb4J6SmOpLWc4K0llsKbg 1V9ZuvZAfpItF9u7EPa9MgCJCeQZYsgxtLKnV4UQrwQKknDW++AVKgaqyGlYuaANNfcs bR6UKPuqg+lNpvJqmvz82yJR5HGwxcNH7WuSz+cJtiodPlmzAiOmG6eOHmOEjD5jEaUf AYRujAGJNpNpMPTdUpEoMljJO3f/fYW3kmPyggl5Sv+eZHU0FBmd5Y9PV1yxAKSX6I3a QaRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QuwwxLI9kehPovTMnhH9tA/I5Dk8xgDmaCwWA+JgdKs=; b=YTND1IyYm6T6pAScHMgs+GGlC8KIdD1kYkqT8a0JOf914skFpfe0kg2s6VVlTV/ief IIUaA9vV8JT3RVZJCAzbJHGMuEjFgz4Tq5o0QY5YhFY07oWAMa3Wik/VFHhfPMQRRAMm LHNOaCZBzONzTKxz9NpquoOmRtLwVS7fVsatZ4cOsDYgdU3VEtQE7avWIdORyoSbt7u9 A2z1w6KGNuqJ3261Ihr5l1Es3TTXNQnwLRkOFBTZ+Wm5bat1JAZ8wRE+KpNr+rFBck5q 7tsAvRq1Qu8SR+wCohkICO0LmOuJFvtmf5uzjdIx6J/KY0w2HHB5ZII6kG1T39WMwtPw GYaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b=jRiBOJ+r; 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 d52si9423592ede.370.2019.10.01.09.57.17; Tue, 01 Oct 2019 09:57:41 -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; dkim=fail header.i=@lunn.ch header.s=20171124 header.b=jRiBOJ+r; 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 S1733184AbfJAQn4 (ORCPT + 99 others); Tue, 1 Oct 2019 12:43:56 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:56406 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732946AbfJAQno (ORCPT ); Tue, 1 Oct 2019 12:43:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=QuwwxLI9kehPovTMnhH9tA/I5Dk8xgDmaCwWA+JgdKs=; b=jRiBOJ+rTkEwl7VFrxVg659ca8 wE80UkiiCyYsOLCNrwJ8A5H//VMB9zBAb5HNTBZlx7/caNEggddhy4ECPA79qLoIGa/5ANSlgzWbo Dn2PDpgELnhdQv1XA2Q33QkzPnsLRMMaa/QjEPiG5pb2NNYCCwJPJ3WRndmIOvHreI7Y=; Received: from andrew by vps0.lunn.ch with local (Exim 4.92.2) (envelope-from ) id 1iFLFU-0001Zn-3t; Tue, 01 Oct 2019 18:43:40 +0200 Date: Tue, 1 Oct 2019 18:43:40 +0200 From: Andrew Lunn To: David Miller 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 Message-ID: <20191001164340.GC2031@lunn.ch> References: <20191001064147.23633-1-o.rempel@pengutronix.de> <20191001.090320.1192378852987776883.davem@davemloft.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191001.090320.1192378852987776883.davem@davemloft.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Andrew