[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b27f69fb-dd93-c852-01e4-a6346c88e9b3@ti.com>
Date: Thu, 17 Nov 2022 15:46:10 +0530
From: Siddharth Vadapalli <s-vadapalli@...com>
To: Paolo Abeni <pabeni@...hat.com>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<robh+dt@...nel.org>, <krzysztof.kozlowski@...aro.org>,
<krzysztof.kozlowski+dt@...aro.org>, <linux@...linux.org.uk>,
<vladimir.oltean@....com>, <vigneshr@...com>, <nsekhar@...com>,
<netdev@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <srk@...com>,
<s-vadapalli@...com>
Subject: Re: [PATCH net-next v5 3/3] net: ethernet: ti: am65-cpsw: Add support
for SERDES configuration
Hello Paolo,
On 10/11/22 18:36, Paolo Abeni wrote:
> hello,
>
> On Wed, 2022-11-09 at 09:52 +0530, Siddharth Vadapalli wrote:
> [...]
>
>> +static void am65_cpsw_disable_serdes_phy(struct am65_cpsw_common *common)
>> +{
>> + struct device_node *node, *port_np;
>> + struct device *dev = common->dev;
>> + const char *name = "serdes-phy";
>> + struct phy *phy;
>> +
>> + node = of_get_child_by_name(dev->of_node, "ethernet-ports");
>> +
>> + for_each_child_of_node(node, port_np) {
>> + phy = devm_of_phy_get(dev, port_np, name);
>
> The above will try to allocate some memory and can fail. Even if the
> the following code will handle a NULL ptr, the phy will not be
> disabled.
>
> I think it's better if you cache the serdes phy ptr in
> am65_cpsw_init_serdes_phy() and you use such reference here, without
> resorting to devm_of_phy_get().
Thank you for reviewing the patch. I plan on creating a new "struct
phy*" member named "serdes_phy" in the struct "am65_cpsw_slave_data"
defined in the file "am65-cpsw-nuss.h", and store the SerDes phy in this
member, during the execution of the am65_cpsw_init_serdes_phy()
function. Please let me know if I can proceed with this implementation.
Regards,
Siddharth.
Powered by blists - more mailing lists