diff mbox series

PCI: tegra: Use PTR_ERR_OR_ZERO

Message ID 20201116165407.8050-1-sudipm.mukherjee@gmail.com
State New
Headers show
Series PCI: tegra: Use PTR_ERR_OR_ZERO | expand

Commit Message

Sudip Mukherjee Nov. 16, 2020, 4:54 p.m. UTC
Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code,
we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then
doing 'return 0'.

Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/pci/controller/pci-tegra.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Thierry Reding Nov. 16, 2020, 5:01 p.m. UTC | #1
On Mon, Nov 16, 2020 at 04:54:07PM +0000, Sudip Mukherjee wrote:
> Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code,
> we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then
> doing 'return 0'.
> 
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> ---
>  drivers/pci/controller/pci-tegra.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

This has been proposed multiple times in the past and Bjorn and I have
agreed every time that this is not an improvement, so sorry, but NAK.

Thierry
Sudip Mukherjee Nov. 23, 2020, 2:51 p.m. UTC | #2
On 16/11/2020 17:01, Thierry Reding wrote:
> On Mon, Nov 16, 2020 at 04:54:07PM +0000, Sudip Mukherjee wrote:
>> Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code,
>> we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then
>> doing 'return 0'.
>>
>> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
>> ---
>>  drivers/pci/controller/pci-tegra.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> This has been proposed multiple times in the past and Bjorn and I have
> agreed every time that this is not an improvement, so sorry, but NAK.

Thanks Thierry and Neil. I have now added a blacklist script in our CI
so "PTR_ERR_OR_ZERO" will not be flagged for anything in drivers/pci/*
anymore in our testing.
Lukas Bulwahn Nov. 23, 2020, 3:01 p.m. UTC | #3
On Mon, Nov 23, 2020 at 3:51 PM Sudip Mukherjee
<sudip.mukherjee@codethink.co.uk> wrote:
>
>
> On 16/11/2020 17:01, Thierry Reding wrote:
> > On Mon, Nov 16, 2020 at 04:54:07PM +0000, Sudip Mukherjee wrote:
> >> Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code,
> >> we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then
> >> doing 'return 0'.
> >>
> >> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> >> ---
> >>  drivers/pci/controller/pci-tegra.c | 4 +---
> >>  1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > This has been proposed multiple times in the past and Bjorn and I have
> > agreed every time that this is not an improvement, so sorry, but NAK.
>
> Thanks Thierry and Neil. I have now added a blacklist script in our CI
> so "PTR_ERR_OR_ZERO" will not be flagged for anything in drivers/pci/*
> anymore in our testing.
>
>

Thanks, Sudip. I think that is a good idea to minimize churn on
subsystem maintainers from janitors.

We can continue to discuss how to share these settings on
ignore-rule-X-on-subsystem-Y with other "analysis tool CI
maintainers".

Lukas
diff mbox series

Patch

diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
index 8fcabed7c6a6..4c52b2d58645 100644
--- a/drivers/pci/controller/pci-tegra.c
+++ b/drivers/pci/controller/pci-tegra.c
@@ -1308,10 +1308,8 @@  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);
 }
 
 static int tegra_pcie_phys_get_legacy(struct tegra_pcie *pcie)