[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220207172800.r35juho7vbdkf634@skbuf>
Date: Mon, 7 Feb 2022 19:28:00 +0200
From: Vladimir Oltean <olteanv@...il.com>
To: Prasanna Vengateshan <prasanna.vengateshan@...rochip.com>
Cc: andrew@...n.ch, netdev@...r.kernel.org, robh+dt@...nel.org,
UNGLinuxDriver@...rochip.com, woojung.huh@...rochip.com,
hkallweit1@...il.com, linux@...linux.org.uk, davem@...emloft.net,
kuba@...nel.org, linux-kernel@...r.kernel.org,
vivien.didelot@...il.com, f.fainelli@...il.com,
devicetree@...r.kernel.org
Subject: Re: [PATCH v8 net-next 05/10] net: dsa: microchip: add DSA support
for microchip lan937x
On Mon, Feb 07, 2022 at 10:51:59PM +0530, Prasanna Vengateshan wrote:
> +static int lan937x_parse_dt_rgmii_delay(struct ksz_device *dev)
> +{
> + struct device_node *ports, *port;
> + int err, p;
> + u32 val;
> +
> + ports = of_get_child_by_name(dev->dev->of_node, "ports");
> + if (!ports)
> + ports = of_get_child_by_name(dev->dev->of_node,
> + "ethernet-ports");
> + if (!ports) {
> + dev_err(dev->dev, "no ports child node found\n");
> + return -EINVAL;
> + }
> +
> + for_each_available_child_of_node(ports, port) {
> + err = of_property_read_u32(port, "reg", &p);
> + if (err) {
> + dev_err(dev->dev, "Port num not defined in the DT, \"reg\" property\n");
> + of_node_put(ports);
> + of_node_put(port);
> + return err;
> + }
> +
> + /* skip for internal ports */
> + if (lan937x_is_internal_phy_port(dev, p))
> + continue;
> +
> + if (of_property_read_u32(port, "rx-internal-delay-ps", &val))
> + val = 0;
> +
> + err = lan937x_set_rgmii_delay(dev, p, val, false);
> + if (err)
I think this call and the one below are missing calls to of_node_put()
on error.
> + return err;
> +
> + if (of_property_read_u32(port, "tx-internal-delay-ps", &val))
> + val = 0;
> +
> + err = lan937x_set_rgmii_delay(dev, p, val, true);
> + if (err)
> + return err;
> + }
> +
> + of_node_put(ports);
> + return 0;
> +}
Powered by blists - more mailing lists