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]
Date:   Tue, 5 Nov 2019 23:34:05 +0800
From:   Chuhong Yuan <hslester96@...il.com>
To:     Andy Duan <fugang.duan@....com>
Cc:     "David S . Miller" <davem@...emloft.net>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [EXT] [PATCH] net: fec: add missed clk_disable_unprepare in remove

On Tue, Nov 5, 2019 at 9:26 AM Andy Duan <fugang.duan@....com> wrote:
>
> From: Chuhong Yuan <hslester96@...il.com> Sent: Monday, November 4, 2019 11:50 PM
> > This driver forgets to disable and unprepare clks when remove.
> > Add calls to clk_disable_unprepare to fix it.
> >
> > Signed-off-by: Chuhong Yuan <hslester96@...il.com>
>
> If runtime is enabled, the patch will introduce clock count mis-match.
> Probe->
>     Enable clk_ipg, clk_ahb clocks
>     ...
>     In the end, runtime auto suspend callback disable clk_ipg, clk_ahb clocks.
>
> You should check CONFIG_PM is enabled or not in your platform, if not,
> it can disable these two clocks by checking CONFIG_PM.
>

Thanks for your hint!
But I am still not very clear about the mechanism.
In my opinion, it means that if CONFIG_PM is disabled, runtime_suspend will
be called automatically to disable clks.
Therefore, #ifdef CONFIG_PM check should be added before disabling
clks in remove.
I am not sure whether this understanding is right or not?

Regards,
Chuhong

> Regards,
> Andy
> > ---
> >  drivers/net/ethernet/freescale/fec_main.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/freescale/fec_main.c
> > b/drivers/net/ethernet/freescale/fec_main.c
> > index 22c01b224baa..a9c386b63581 100644
> > --- a/drivers/net/ethernet/freescale/fec_main.c
> > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > @@ -3645,6 +3645,8 @@ fec_drv_remove(struct platform_device *pdev)
> >                 regulator_disable(fep->reg_phy);
> >         pm_runtime_put(&pdev->dev);
> >         pm_runtime_disable(&pdev->dev);
> > +       clk_disable_unprepare(fep->clk_ahb);
> > +       clk_disable_unprepare(fep->clk_ipg);
> >         if (of_phy_is_fixed_link(np))
> >                 of_phy_deregister_fixed_link(np);
> >         of_node_put(fep->phy_node);
> > --
> > 2.23.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ