From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 928A71426B; Mon, 8 Jan 2024 11:15:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SrAC5YaC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE990C433C7; Mon, 8 Jan 2024 11:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704712510; bh=3onyJACON7UN+r62nN4g7w7HHbRgM+h21qgM1D0k0r8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SrAC5YaC8C/78giFGYGDmAO9hHqI3cDeSUnGDufaz+cC39G+F4UziFgYogb6u2b7m s0/BFGaX7LSMtEXbDTbVufZhX0s+xPtXJB2ylD9Dl5a/sGc4EmcrjerEGAwqbZfH2p k3cb0Z0ZJBWANO3X35IRgq9ozi7qLcGxzPXx2QlQjZqy/6rwnsbk/iqjUFuPvO6GN1 0wtZBFUZggsU8UHeHWMqg19y5k8b2j1NqHV8Jstg3VFNmsPg7MJJRaImu/vqxolo2M yOQ3bimzkhEhBk37koV4IwJ7P3++y9xTMUOG8/YNEUGEMX5KjGVSG+cWSXDlbx2zCD 2PD+Mjyl74ZAg== Date: Mon, 8 Jan 2024 11:15:03 +0000 From: Simon Horman To: Vladimir Oltean Cc: =?utf-8?B?QXLEsW7DpyDDnE5BTA==?= , Daniel Golle , Landen Chao , DENG Qingfang , Sean Wang , Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , David Bauer , mithat.guner@xeront.com, erkin.bozoglu@xeront.com, Luiz Angelo Daros de Luca , 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: support OF-based registration of switch MDIO bus Message-ID: <20240108111503.GI132648@kernel.org> References: <20240106122142.235389-1-arinc.unal@arinc9.com> <20240107195241.GB132648@kernel.org> <65274929-fa59-482c-a744-6b9ce162ab46@arinc9.com> <20240108110000.aujqhlufehngtkjj@skbuf> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240108110000.aujqhlufehngtkjj@skbuf> On Mon, Jan 08, 2024 at 01:00:00PM +0200, Vladimir Oltean wrote: > On Mon, Jan 08, 2024 at 01:22:18PM +0300, Arınç ÜNAL wrote: > > > > diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c > > > > index 391c4dbdff42..39d7e7ad7154 100644 > > > > --- a/drivers/net/dsa/mt7530.c > > > > +++ b/drivers/net/dsa/mt7530.c > > > > @@ -2153,17 +2153,25 @@ mt7530_free_irq(struct mt7530_priv *priv) > > > > static int > > > > mt7530_setup_mdio(struct mt7530_priv *priv) > > > > { > > > > + struct device_node *mnp, *np = priv->dev->of_node; > > > > struct dsa_switch *ds = priv->ds; > > > > struct device *dev = priv->dev; > > > > struct mii_bus *bus; > > > > static int idx; > > > > - int ret; > > > > + int ret = 0; > > > > + > > > > + mnp = of_get_child_by_name(np, "mdio"); > > > > + > > > > + if (mnp && !of_device_is_available(mnp)) > > > > + goto out; > > > > > > nit: I think it would easier on the eyes to simply > > > > > > return 0; > > Actually "return 0" leaks "mnp". An of_node_put() is needed. Yes, sorry for not noticing that.