lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=MfEuAhichw-tPJkj_BKxy7AzvfmVJJyXzHsqa2wf=2EKw@mail.gmail.com>
Date: Thu, 13 Nov 2025 15:39:45 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Simon Horman <horms@...nel.org>
Cc: Bjorn Andersson <andersson@...nel.org>, Konrad Dybcio <konradybcio@...nel.org>, 
	Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, 
	Richard Cochran <richardcochran@...il.com>, Andrew Lunn <andrew+netdev@...n.ch>, 
	"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
	Maxime Coquelin <mcoquelin.stm32@...il.com>, Alexandre Torgue <alexandre.torgue@...s.st.com>, 
	Vinod Koul <vkoul@...nel.org>, Giuseppe Cavallaro <peppe.cavallaro@...com>, 
	Jose Abreu <joabreu@...opsys.com>, Chen-Yu Tsai <wens@...nel.org>, 
	Jernej Skrabec <jernej.skrabec@...il.com>, Samuel Holland <samuel@...lland.org>, 
	Matthew Gerlach <matthew.gerlach@...era.com>, Neil Armstrong <neil.armstrong@...aro.org>, 
	Kevin Hilman <khilman@...libre.com>, Jerome Brunet <jbrunet@...libre.com>, 
	Martin Blumenstingl <martin.blumenstingl@...glemail.com>, 
	Keguang Zhang <keguang.zhang@...il.com>, Shawn Guo <shawnguo@...nel.org>, 
	Sascha Hauer <s.hauer@...gutronix.de>, Pengutronix Kernel Team <kernel@...gutronix.de>, 
	Fabio Estevam <festevam@...il.com>, Jan Petrous <jan.petrous@....nxp.com>, s32@....com, 
	Romain Gantois <romain.gantois@...tlin.com>, 
	Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>, Heiko Stuebner <heiko@...ech.de>, 
	Chen Wang <unicorn_wang@...look.com>, Inochi Amaoto <inochiama@...il.com>, 
	Emil Renner Berthing <kernel@...il.dk>, Minda Chen <minda.chen@...rfivetech.com>, 
	Drew Fustini <fustini@...nel.org>, Guo Ren <guoren@...nel.org>, Fu Wei <wefu@...hat.com>, 
	Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@...l.toshiba>, 
	Geert Uytterhoeven <geert+renesas@...der.be>, Magnus Damm <magnus.damm@...il.com>, 
	Maxime Ripard <mripard@...nel.org>, Shuang Liang <liangshuang@...incomputing.com>, 
	Zhi Li <lizhi2@...incomputing.com>, Shangjuan Wei <weishangjuan@...incomputing.com>, 
	"G. Jaya Kumaran" <vineetha.g.jaya.kumaran@...el.com>, Clark Wang <xiaoning.wang@....com>, 
	Linux Team <linux-imx@....com>, Frank Li <Frank.Li@....com>, David Wu <david.wu@...k-chips.com>, 
	Samin Guo <samin.guo@...rfivetech.com>, 
	Christophe Roullier <christophe.roullier@...s.st.com>, Swathi K S <swathi.ks@...sung.com>, 
	linux-arm-msm@...r.kernel.org, devicetree@...r.kernel.org, 
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org, 
	linux-stm32@...md-mailman.stormreply.com, 
	linux-arm-kernel@...ts.infradead.org, Drew Fustini <dfustini@...storrent.com>, 
	linux-sunxi@...ts.linux.dev, linux-amlogic@...ts.infradead.org, 
	linux-mips@...r.kernel.org, imx@...ts.linux.dev, 
	linux-renesas-soc@...r.kernel.org, linux-rockchip@...ts.infradead.org, 
	sophgo@...ts.linux.dev, linux-riscv@...ts.infradead.org, 
	Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH v5 8/8] net: stmmac: qcom-ethqos: add support for sa8255p

On Tue, Nov 11, 2025 at 12:48 PM Simon Horman <horms@...nel.org> wrote:
>
> On Fri, Nov 07, 2025 at 11:29:58AM +0100, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
>
> ...
>
> > +static int qcom_ethqos_pd_init(struct platform_device *pdev, void *priv)
> > +{
> > +     struct qcom_ethqos *ethqos = priv;
> > +     int ret;
> > +
> > +     /*
> > +      * Enable functional clock to prevent DMA reset after timeout due
> > +      * to no PHY clock being enabled after the hardware block has been
> > +      * power cycled. The actual configuration will be adjusted once
> > +      * ethqos_fix_mac_speed() is called.
> > +      */
> > +     ethqos_set_func_clk_en(ethqos);
> > +
> > +     ret = qcom_ethqos_domain_on(ethqos, ETHQOS_PD_CORE);
> > +     if (ret)
> > +             return ret;
> > +
> > +     ret = qcom_ethqos_domain_on(ethqos, ETHQOS_PD_MDIO);
> > +     if (ret) {
> > +             qcom_ethqos_domain_off(ethqos, ETHQOS_PD_CORE);
> > +             return ret;
> > +     }
> > +
> > +     return 0;
> > +}
> > +
> > +static void qcom_ethqos_pd_exit(struct platform_device *pdev, void *data)
> > +{
> > +     struct qcom_ethqos *ethqos = data;
> > +
> > +     qcom_ethqos_domain_off(ethqos, ETHQOS_PD_MDIO);
> > +     qcom_ethqos_domain_off(ethqos, ETHQOS_PD_CORE);
> > +}
> > +
> >  static void ethqos_ptp_clk_freq_config(struct stmmac_priv *priv)
> >  {
> >       struct plat_stmmacenet_data *plat_dat = priv->plat;
>
> ...
>
> > @@ -852,28 +993,63 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
> >       ethqos->rgmii_config_loopback_en = drv_data->rgmii_config_loopback_en;
> >       ethqos->has_emac_ge_3 = drv_data->has_emac_ge_3;
> >       ethqos->needs_sgmii_loopback = drv_data->needs_sgmii_loopback;
> > -
> > -     ethqos->pm.link_clk = devm_clk_get(dev, clk_name);
> > -     if (IS_ERR(ethqos->pm.link_clk))
> > -             return dev_err_probe(dev, PTR_ERR(ethqos->pm.link_clk),
> > -                                  "Failed to get link_clk\n");
> > -
> > -     ret = ethqos_clks_config(ethqos, true);
> > -     if (ret)
> > -             return ret;
> > -
> > -     ret = devm_add_action_or_reset(dev, ethqos_clks_disable, ethqos);
> > -     if (ret)
> > -             return ret;
> > -
> > -     ethqos->pm.serdes_phy = devm_phy_optional_get(dev, "serdes");
> > -     if (IS_ERR(ethqos->pm.serdes_phy))
> > -             return dev_err_probe(dev, PTR_ERR(ethqos->pm.serdes_phy),
> > -                                  "Failed to get serdes phy\n");
> > -
> > -     ethqos->set_serdes_speed = ethqos_set_serdes_speed_phy;
> >       ethqos->serdes_speed = SPEED_1000;
> > -     ethqos_update_link_clk(ethqos, SPEED_1000);
> > +
> > +     if (pm_data && pm_data->use_domains) {
> > +             ethqos->set_serdes_speed = ethqos_set_serdes_speed_pd;
> > +
> > +             ret = devm_pm_domain_attach_list(dev, &pm_data->pd,
> > +                                              &ethqos->pd.pd_list);
> > +             if (ret < 0)
> > +                     return dev_err_probe(dev, ret, "Failed to attach power domains\n");
> > +
> > +             plat_dat->clks_config = ethqos_pd_clks_config;
> > +             plat_dat->serdes_powerup = qcom_ethqos_pd_serdes_powerup;
> > +             plat_dat->serdes_powerdown = qcom_ethqos_pd_serdes_powerdown;
> > +             plat_dat->exit = qcom_ethqos_pd_exit;
>
> Hi Bartosz,
>
> It seems that the intention of this is to ensure
> that domains turned on by qcom_ethqos_pd_init()
> are turned off again on exit or clean-up in error paths.
>
> > +             plat_dat->init = qcom_ethqos_pd_init;
> > +             plat_dat->clk_ptp_rate = pm_data->clk_ptp_rate;
> > +
> > +             ret = qcom_ethqos_pd_init(pdev, ethqos);
> > +             if (ret)
> > +                     return ret;
>
> And here those domains are turned on.
>
> > +
> > +             ret = qcom_ethqos_domain_on(ethqos, ETHQOS_PD_SERDES);
> > +             if (ret)
>
> But it seems that if we reach this error path then the cleanup is not
> performed. This is because plat_dat and thus it's exit callback are
> registered until the call to devm_stmmac_pltfr_probe() towards the end of
> this function.

We can only reach this if devm_stmmac_pltfr_probe() fails. Yeah it
probably warrants a devres action.

Bartosz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ