[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220519180851.chpqhou7ykt45oty@skbuf>
Date: Thu, 19 May 2022 21:08:51 +0300
From: Vladimir Oltean <olteanv@...il.com>
To: Clément Léger <clement.leger@...tlin.com>
Cc: Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Herve Codina <herve.codina@...tlin.com>,
Miquèl Raynal <miquel.raynal@...tlin.com>,
Milan Stevanovic <milan.stevanovic@...com>,
Jimmy Lalande <jimmy.lalande@...com>,
Pascal Eberhard <pascal.eberhard@...com>,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
linux-renesas-soc@...r.kernel.org, netdev@...r.kernel.org,
Jean-Pierre Geslin <jean-pierre.geslin@....se.com>,
Phil Edworthy <phil.edworthy@...esas.com>
Subject: Re: [PATCH net-next v5 07/13] net: dsa: rzn1-a5psw: add Renesas
RZ/N1 advanced 5 port switch driver
On Thu, May 19, 2022 at 05:31:01PM +0200, Clément Léger wrote:
> +static int a5psw_pcs_get(struct a5psw *a5psw)
> +{
> + struct device_node *ports, *port, *pcs_node;
> + struct phylink_pcs *pcs;
> + int ret;
> + u32 reg;
> +
> + ports = of_get_child_by_name(a5psw->dev->of_node, "ethernet-ports");
> + if (!ports)
> + return -EINVAL;
> +
> + for_each_available_child_of_node(ports, port) {
> + pcs_node = of_parse_phandle(port, "pcs-handle", 0);
> + if (!pcs_node)
> + continue;
> +
> + if (of_property_read_u32(port, "reg", ®)) {
> + ret = -EINVAL;
> + goto free_pcs;
I think when you exit the for_each_available_child_of_node() loop you
need to manually call of_node_put(port).
> + }
> +
> + if (reg >= ARRAY_SIZE(a5psw->pcs)) {
> + ret = -ENODEV;
> + goto free_pcs;
> + }
> +
> + pcs = miic_create(pcs_node);
> + if (IS_ERR(pcs)) {
> + dev_err(a5psw->dev, "Failed to create PCS for port %d\n",
> + reg);
> + ret = PTR_ERR(pcs);
> + goto free_pcs;
> + }
> +
> + a5psw->pcs[reg] = pcs;
> + }
> + of_node_put(ports);
> +
> + return 0;
> +
> +free_pcs:
> + a5psw_pcs_free(a5psw);
> + of_node_put(ports);
> +
> + return ret;
> +}
Powered by blists - more mailing lists