Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1722524

Re: [PATCH] PCI: tegra: Use PTR_ERR_OR_ZERO

From Himanshu Jha <himanshujha199640@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] PCI: tegra: Use PTR_ERR_OR_ZERO
Date 2017-08-29 16:20 +0200
Message-ID <ujPwZ-3FG-1@gated-at.bofh.it> (permalink)
References <ujOUi-3dt-29@gated-at.bofh.it> <ujPdF-3jM-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Aug 29, 2017 at 03:55:17PM +0200, Thierry Reding wrote:
> On Tue, Aug 29, 2017 at 07:09:00PM +0530, Himanshu Jha wrote:
> > Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> > 
> > Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> > ---
> >  drivers/pci/host/pci-tegra.c | 5 +----
> >  1 file changed, 1 insertion(+), 4 deletions(-)
> > 
> > diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
> > index 9c40da5..90cda5b 100644
> > --- a/drivers/pci/host/pci-tegra.c
> > +++ b/drivers/pci/host/pci-tegra.c
> > @@ -1156,10 +1156,7 @@ static int tegra_pcie_resets_get(struct tegra_pcie *pcie)
> >  		return PTR_ERR(pcie->afi_rst);
> >  
> >  	pcie->pcie_xrst = devm_reset_control_get_exclusive(dev, "pcie_x");
> > -	if (IS_ERR(pcie->pcie_xrst))
> > -		return PTR_ERR(pcie->pcie_xrst);
> > -
> > -	return 0;
> > +	return PTR_ERR_OR_ZERO(pcie->pcie_xrst);
> >  }
> 
> I'm not a big fan of this construct because it's a pain to undo this if
> ever we need to add code to this function. But since we do have scripts
> that will flag this, I guess this would pop up every now and again. The
> driver is unlikely to change in this part, too, so:

What do you suggest ? Shall I stop sending these patches ?

Thanks
-Himanshu Jha

> Acked-by: Thierry Reding <treding@nvidia.com>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] PCI: tegra: Use PTR_ERR_OR_ZERO Himanshu Jha <himanshujha199640@gmail.com> - 2017-08-29 15:40 +0200
  Re: [PATCH] PCI: tegra: Use PTR_ERR_OR_ZERO Thierry Reding <thierry.reding@gmail.com> - 2017-08-29 16:00 +0200
    Re: [PATCH] PCI: tegra: Use PTR_ERR_OR_ZERO Himanshu Jha <himanshujha199640@gmail.com> - 2017-08-29 16:20 +0200
      Re: [PATCH] PCI: tegra: Use PTR_ERR_OR_ZERO Thierry Reding <thierry.reding@gmail.com> - 2017-08-29 17:20 +0200
    Re: [PATCH] PCI: tegra: Use PTR_ERR_OR_ZERO Bjorn Helgaas <helgaas@kernel.org> - 2017-08-30 16:00 +0200
      Re: [PATCH] PCI: tegra: Use PTR_ERR_OR_ZERO Thierry Reding <thierry.reding@gmail.com> - 2017-08-30 16:30 +0200
        Re: [PATCH] PCI: tegra: Use PTR_ERR_OR_ZERO Bjorn Helgaas <helgaas@kernel.org> - 2017-08-30 18:30 +0200

csiph-web