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: <20211116204003.GA1678373@bhelgaas>
Date:   Tue, 16 Nov 2021 14:40:03 -0600
From:   Bjorn Helgaas <helgaas@...nel.org>
To:     Jim Quinlan <james.quinlan@...adcom.com>
Cc:     Jim Quinlan <jim2101024@...il.com>,
        "open list:PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS" 
        <linux-pci@...r.kernel.org>, Bjorn Helgaas <bhelgaas@...gle.com>,
        Nicolas Saenz Julienne <nsaenz@...nel.org>,
        Rob Herring <robh@...nel.org>, Mark Brown <broonie@...nel.org>,
        "maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE" 
        <bcm-kernel-feedback-list@...adcom.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        Krzysztof WilczyƄski <kw@...ux.com>,
        "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" 
        <linux-rpi-kernel@...ts.infradead.org>,
        "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" 
        <linux-arm-kernel@...ts.infradead.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v8 1/8] PCI: brcmstb: Change brcm_phy_stop() to return
 void

On Mon, Nov 15, 2021 at 03:56:14PM -0500, Jim Quinlan wrote:
> On Thu, Nov 11, 2021 at 4:57 PM Bjorn Helgaas <helgaas@...nel.org> wrote:
> > On Wed, Nov 10, 2021 at 05:14:41PM -0500, Jim Quinlan wrote:
> > > We do not use the result of this function so make it void.
> >
> > I don't get it.  Can you expand on this?
> >
> > brcm_phy_cntl() can return -EIO, which means brcm_phy_stop() can
> > return -EIO, which means brcm_pcie_suspend can return -EIO.
> > brcm_pcie_suspend() is the dev_pm_ops.suspend() method.
> >
> > So are you saying we never use the result of dev_pm_ops.suspend()?
> 
> In this situation we are going into suspend.  In doing so, any
> problems with the brcm phy may be erased/forgiven upon resume, since
> clocks are turned off and most power removed/reduced.  An error from
> brcm_phy_stop() that becomes the return value of  brcm_pcie_suspend()
> will bring a halt to the entire suspend IIRC.   In fact, I forced a
> -EIO in this code and it panic'd on suspend.  This is not really the
> behavior I want for what is most likely a recoverable error.
> 
> Perhaps a dev_err(...) will suffice while still returning 0?

Maybe we just need a note about why we want to intentionally ignore
any errors here.

> I noticed that reset_control_rearm() also returns a value, and if that
> is in error it will not be erease/forgiven  by suspend sleep.  I will
> fix this.
> 
> Regards,
> Jim Quinlan
> Broadcom STB
> 
> 
> >
> > > Signed-off-by: Jim Quinlan <jim2101024@...il.com>
> > > ---
> > >  drivers/pci/controller/pcie-brcmstb.c | 10 +++++-----
> > >  1 file changed, 5 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> > > index cc30215f5a43..ff7d0d291531 100644
> > > --- a/drivers/pci/controller/pcie-brcmstb.c
> > > +++ b/drivers/pci/controller/pcie-brcmstb.c
> > > @@ -1111,9 +1111,10 @@ static inline int brcm_phy_start(struct brcm_pcie *pcie)
> > >       return pcie->rescal ? brcm_phy_cntl(pcie, 1) : 0;
> > >  }
> > >
> > > -static inline int brcm_phy_stop(struct brcm_pcie *pcie)
> > > +static inline void brcm_phy_stop(struct brcm_pcie *pcie)
> > >  {
> > > -     return pcie->rescal ? brcm_phy_cntl(pcie, 0) : 0;
> > > +     if (pcie->rescal)
> > > +             brcm_phy_cntl(pcie, 0);
> > >  }
> > >
> > >  static void brcm_pcie_turn_off(struct brcm_pcie *pcie)
> > > @@ -1143,14 +1144,13 @@ static void brcm_pcie_turn_off(struct brcm_pcie *pcie)
> > >  static int brcm_pcie_suspend(struct device *dev)
> > >  {
> > >       struct brcm_pcie *pcie = dev_get_drvdata(dev);
> > > -     int ret;
> > >
> > >       brcm_pcie_turn_off(pcie);
> > > -     ret = brcm_phy_stop(pcie);
> > > +     brcm_phy_stop(pcie);
> > >       reset_control_rearm(pcie->rescal);
> > >       clk_disable_unprepare(pcie->clk);
> > >
> > > -     return ret;
> > > +     return 0;
> > >  }
> > >
> > >  static int brcm_pcie_resume(struct device *dev)
> > > --
> > > 2.17.1
> > >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ