All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Simon Horman <horms@kernel.org>
Cc: Yao Zi <ziyao@disroot.org>, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	David Wu <david.wu@rock-chips.com>,
	Chaoyi Chen <chaoyi.chen@rock-chips.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org
Subject: Re: [PATCH net] net: stmmac: dwmac-rk: Ensure clk_phy doesn't contain invalid address
Date: Thu, 4 Sep 2025 11:49:33 +0100	[thread overview]
Message-ID: <aLluvYQ-i-Z9vyp7@shell.armlinux.org.uk> (raw)
In-Reply-To: <20250904103443.GH372207@horms.kernel.org>

On Thu, Sep 04, 2025 at 11:34:43AM +0100, Simon Horman wrote:
> Thanks, and sorry for my early confusion about applying this patch.
> 
> I agree that the bug you point out is addressed by this patch.
> Although I wonder if it is cleaner not to set bsp_priv->clk_phy
> unless there is no error, rather than setting it then resetting
> it if there is an error.

+1 !

> More importantly, I wonder if there is another bug: does clk_set_rate need
> to be called in the case where there is no error and bsp_priv->integrated_phy
> is false?

I think there's another issue:

static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat)
{
...
        if (plat->phy_node) {
                bsp_priv->clk_phy = of_clk_get(plat->phy_node, 0);
...

static void rk_gmac_remove(struct platform_device *pdev)
{
...
        if (priv->plat->phy_node && bsp_priv->integrated_phy)
                clk_put(bsp_priv->clk_phy);

So if bsp_priv->integrated_phy is false, then we get the clock but
don't put it.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


WARNING: multiple messages have this Message-ID (diff)
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Simon Horman <horms@kernel.org>
Cc: Yao Zi <ziyao@disroot.org>, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	David Wu <david.wu@rock-chips.com>,
	Chaoyi Chen <chaoyi.chen@rock-chips.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org
Subject: Re: [PATCH net] net: stmmac: dwmac-rk: Ensure clk_phy doesn't contain invalid address
Date: Thu, 4 Sep 2025 11:49:33 +0100	[thread overview]
Message-ID: <aLluvYQ-i-Z9vyp7@shell.armlinux.org.uk> (raw)
In-Reply-To: <20250904103443.GH372207@horms.kernel.org>

On Thu, Sep 04, 2025 at 11:34:43AM +0100, Simon Horman wrote:
> Thanks, and sorry for my early confusion about applying this patch.
> 
> I agree that the bug you point out is addressed by this patch.
> Although I wonder if it is cleaner not to set bsp_priv->clk_phy
> unless there is no error, rather than setting it then resetting
> it if there is an error.

+1 !

> More importantly, I wonder if there is another bug: does clk_set_rate need
> to be called in the case where there is no error and bsp_priv->integrated_phy
> is false?

I think there's another issue:

static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat)
{
...
        if (plat->phy_node) {
                bsp_priv->clk_phy = of_clk_get(plat->phy_node, 0);
...

static void rk_gmac_remove(struct platform_device *pdev)
{
...
        if (priv->plat->phy_node && bsp_priv->integrated_phy)
                clk_put(bsp_priv->clk_phy);

So if bsp_priv->integrated_phy is false, then we get the clock but
don't put it.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2025-09-04 12:27 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04  3:12 [PATCH net] net: stmmac: dwmac-rk: Ensure clk_phy doesn't contain invalid address Yao Zi
2025-09-04  3:12 ` Yao Zi
2025-09-04  9:54 ` Simon Horman
2025-09-04  9:54   ` Simon Horman
2025-09-04  9:56   ` Simon Horman
2025-09-04  9:56     ` Simon Horman
2025-09-04 10:10     ` Yao Zi
2025-09-04 10:10       ` Yao Zi
2025-09-04 10:28       ` Simon Horman
2025-09-04 10:28         ` Simon Horman
2025-09-04 10:34 ` Simon Horman
2025-09-04 10:34   ` Simon Horman
2025-09-04 10:49   ` Russell King (Oracle) [this message]
2025-09-04 10:49     ` Russell King (Oracle)
2025-09-04 10:58     ` Chaoyi Chen
2025-09-04 10:58       ` Chaoyi Chen
2025-09-04 11:20       ` Yao Zi
2025-09-04 11:20         ` Yao Zi
2025-09-04 11:13   ` Yao Zi
2025-09-04 11:13     ` Yao Zi
2025-09-04 10:58 ` Russell King (Oracle)
2025-09-04 10:58   ` Russell King (Oracle)
2025-09-04 11:03   ` Chaoyi Chen
2025-09-04 11:03     ` Chaoyi Chen
2025-09-04 11:05     ` Russell King (Oracle)
2025-09-04 11:05       ` Russell King (Oracle)
2025-09-04 11:07       ` Russell King (Oracle)
2025-09-04 11:07         ` Russell King (Oracle)
2025-09-06  5:36         ` Yao Zi
2025-09-06  5:36           ` Yao Zi
2025-09-06  6:26           ` Chaoyi Chen
2025-09-06  6:26             ` Chaoyi Chen
2025-09-06 20:25             ` Sebastian Reichel
2025-09-06 20:25               ` Sebastian Reichel
2025-09-15  3:38               ` Chaoyi Chen
2025-09-15  3:38                 ` Chaoyi Chen

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=aLluvYQ-i-Z9vyp7@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew+netdev@lunn.ch \
    --cc=chaoyi.chen@rock-chips.com \
    --cc=davem@davemloft.net \
    --cc=david.wu@rock-chips.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jonas@kwiboo.se \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ziyao@disroot.org \
    /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.