All of lore.kernel.org
 help / color / mirror / Atom feed
From: Siddharth Vadapalli <s-vadapalli@ti.com>
To: Paolo Abeni <pabeni@redhat.com>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<robh+dt@kernel.org>, <krzysztof.kozlowski@linaro.org>,
	<krzysztof.kozlowski+dt@linaro.org>, <linux@armlinux.org.uk>,
	<vladimir.oltean@nxp.com>, <vigneshr@ti.com>, <nsekhar@ti.com>,
	<netdev@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <srk@ti.com>,
	<s-vadapalli@ti.com>
Subject: Re: [PATCH net-next v5 3/3] net: ethernet: ti: am65-cpsw: Add support for SERDES configuration
Date: Thu, 17 Nov 2022 15:46:10 +0530	[thread overview]
Message-ID: <b27f69fb-dd93-c852-01e4-a6346c88e9b3@ti.com> (raw)
In-Reply-To: <d5f0dea1b9ce5f8d2187875adb1d73e747e21916.camel@redhat.com>

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.

WARNING: multiple messages have this Message-ID (diff)
From: Siddharth Vadapalli <s-vadapalli@ti.com>
To: Paolo Abeni <pabeni@redhat.com>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<robh+dt@kernel.org>, <krzysztof.kozlowski@linaro.org>,
	<krzysztof.kozlowski+dt@linaro.org>, <linux@armlinux.org.uk>,
	<vladimir.oltean@nxp.com>, <vigneshr@ti.com>, <nsekhar@ti.com>,
	<netdev@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <srk@ti.com>,
	<s-vadapalli@ti.com>
Subject: Re: [PATCH net-next v5 3/3] net: ethernet: ti: am65-cpsw: Add support for SERDES configuration
Date: Thu, 17 Nov 2022 15:46:10 +0530	[thread overview]
Message-ID: <b27f69fb-dd93-c852-01e4-a6346c88e9b3@ti.com> (raw)
In-Reply-To: <d5f0dea1b9ce5f8d2187875adb1d73e747e21916.camel@redhat.com>

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.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-11-17 10:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09  4:22 [PATCH net-next v5 0/3] Add support for QSGMII mode for J721e CPSW9G to am65-cpsw driver Siddharth Vadapalli
2022-11-09  4:22 ` Siddharth Vadapalli
2022-11-09  4:22 ` [PATCH net-next v5 1/3] dt-bindings: net: ti: k3-am654-cpsw-nuss: Add J721e CPSW9G support Siddharth Vadapalli
2022-11-09  4:22   ` Siddharth Vadapalli
2022-11-09  4:22 ` [PATCH net-next v5 2/3] net: ethernet: ti: am65-cpsw: Enable QSGMII mode for J721e CPSW9G Siddharth Vadapalli
2022-11-09  4:22   ` Siddharth Vadapalli
2022-11-09  4:22 ` [PATCH net-next v5 3/3] net: ethernet: ti: am65-cpsw: Add support for SERDES configuration Siddharth Vadapalli
2022-11-09  4:22   ` Siddharth Vadapalli
2022-11-10 13:06   ` Paolo Abeni
2022-11-10 13:06     ` Paolo Abeni
2022-11-17 10:16     ` Siddharth Vadapalli [this message]
2022-11-17 10:16       ` Siddharth Vadapalli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b27f69fb-dd93-c852-01e4-a6346c88e9b3@ti.com \
    --to=s-vadapalli@ti.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=pabeni@redhat.com \
    --cc=robh+dt@kernel.org \
    --cc=srk@ti.com \
    --cc=vigneshr@ti.com \
    --cc=vladimir.oltean@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.