[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <170680562826.4979.15332968112575820833@kwain>
Date: Thu, 01 Feb 2024 17:40:28 +0100
From: Antoine Tenart <atenart@...nel.org>
To: Andrew Lunn <andrew@...n.ch>, Bjorn Andersson <andersson@...nel.org>, Christian Marangi <ansuelsmth@...il.com>, Conor Dooley <conor+dt@...nel.org>, David S. Miller <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Frank Rowand <frowand.list@...il.com>, Heiner Kallweit <hkallweit1@...il.com>, Jakub Kicinski <kuba@...nel.org>, Konrad Dybcio <konrad.dybcio@...aro.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>, Paolo Abeni <pabeni@...hat.com>, Rob Herring <robh+dt@...nel.org>, Robert Marko <robert.marko@...tura.hr>, Russell King <linux@...linux.org.uk>, devicetree@...r.kernel.org, linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [net-next PATCH v5 3/9] net: phy: add devm/of_phy_package_join helper
Quoting Christian Marangi (2024-02-01 16:17:29)
> +/**
> + * of_phy_package_join - join a common PHY group in PHY package
> + * @phydev: target phy_device struct
> + * @priv_size: if non-zero allocate this amount of bytes for private data
> + *
> + * This is a variant of phy_package_join for PHY package defined in DT.
> + *
> + * The parent node of the @phydev is checked as a valid PHY package node
> + * structure (by matching the node name "ethernet-phy-package") and the
> + * base_addr for the PHY package is passed to phy_package_join.
> + *
> + * With this configuration the shared struct will also have the np value
> + * filled to use additional DT defined properties in PHY specific
> + * probe_once and config_init_once PHY package OPs.
> + *
> + * Returns < 1 on error, 0 on success. Esp. calling phy_package_join()
So, < 0 on error ?
> +int of_phy_package_join(struct phy_device *phydev, size_t priv_size)
> +{
> + struct device_node *node = phydev->mdio.dev.of_node;
> + struct device_node *package_node;
> + u32 base_addr;
> + int ret;
> +
> + if (!node)
> + return -EINVAL;
> +
> + package_node = of_get_parent(node);
Is the node put on package leave?
> + if (!package_node)
> + return -EINVAL;
> +
> + if (!of_node_name_eq(package_node, "ethernet-phy-package")
of_put_node? + below.
> + return -EINVAL;
> +
> + if (of_property_read_u32(package_node, "reg", &base_addr))
> + return -EINVAL;
> +
> + ret = phy_package_join(phydev, base_addr, priv_size);
> + if (ret)
> + return ret;
> +
> + phydev->shared->np = package_node;
Just looked quickly, looks like ->np is uninitialized in the !of join
case.
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(of_phy_package_join);
Powered by blists - more mailing lists