Re: [PATCH v8 net-next 05/10] net: dsa: microchip: add DSA support for microchip lan937x

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
> +}



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux