All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Siddharth Vadapalli <s-vadapalli@ti.com>,
	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
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, srk@ti.com
Subject: Re: [PATCH net-next v5 3/3] net: ethernet: ti: am65-cpsw: Add support for SERDES configuration
Date: Thu, 10 Nov 2022 14:06:47 +0100	[thread overview]
Message-ID: <d5f0dea1b9ce5f8d2187875adb1d73e747e21916.camel@redhat.com> (raw)
In-Reply-To: <20221109042203.375042-4-s-vadapalli@ti.com>

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().

Cheers,

Paolo


WARNING: multiple messages have this Message-ID (diff)
From: Paolo Abeni <pabeni@redhat.com>
To: Siddharth Vadapalli <s-vadapalli@ti.com>,
	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
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, srk@ti.com
Subject: Re: [PATCH net-next v5 3/3] net: ethernet: ti: am65-cpsw: Add support for SERDES configuration
Date: Thu, 10 Nov 2022 14:06:47 +0100	[thread overview]
Message-ID: <d5f0dea1b9ce5f8d2187875adb1d73e747e21916.camel@redhat.com> (raw)
In-Reply-To: <20221109042203.375042-4-s-vadapalli@ti.com>

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().

Cheers,

Paolo


_______________________________________________
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-10 13:08 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 [this message]
2022-11-10 13:06     ` Paolo Abeni
2022-11-17 10:16     ` Siddharth Vadapalli
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=d5f0dea1b9ce5f8d2187875adb1d73e747e21916.camel@redhat.com \
    --to=pabeni@redhat.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=robh+dt@kernel.org \
    --cc=s-vadapalli@ti.com \
    --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.