* [PATCH] PCI: tegra: Use PTR_ERR_OR_ZERO() to simplify code
@ 2019-11-18 11:11 zhengbin
2019-11-18 13:19 ` Thierry Reding
0 siblings, 1 reply; 2+ messages in thread
From: zhengbin @ 2019-11-18 11:11 UTC (permalink / raw)
To: thierry.reding, lorenzo.pieralisi, andrew.murray, bhelgaas,
jonathanh, linux-tegra, linux-pci
Cc: zhengbin13
Fixes coccicheck warning:
drivers/pci/controller/pci-tegra.c:1365:1-3: WARNING: PTR_ERR_OR_ZERO can be used
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
---
drivers/pci/controller/pci-tegra.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
index 673a172..8503ae5 100644
--- a/drivers/pci/controller/pci-tegra.c
+++ b/drivers/pci/controller/pci-tegra.c
@@ -1362,10 +1362,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);
}
static int tegra_pcie_phys_get_legacy(struct tegra_pcie *pcie)
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI: tegra: Use PTR_ERR_OR_ZERO() to simplify code
2019-11-18 11:11 [PATCH] PCI: tegra: Use PTR_ERR_OR_ZERO() to simplify code zhengbin
@ 2019-11-18 13:19 ` Thierry Reding
0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2019-11-18 13:19 UTC (permalink / raw)
To: zhengbin
Cc: lorenzo.pieralisi, andrew.murray, bhelgaas, jonathanh,
linux-tegra, linux-pci
[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]
On Mon, Nov 18, 2019 at 07:11:18PM +0800, zhengbin wrote:
> Fixes coccicheck warning:
>
> drivers/pci/controller/pci-tegra.c:1365:1-3: WARNING: PTR_ERR_OR_ZERO can be used
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: zhengbin <zhengbin13@huawei.com>
> ---
> drivers/pci/controller/pci-tegra.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
Please don't. This is a completely useless conversion. Having this
rolled up into one just makes the diff harder to read the next time we
need to add some error checking to this function.
Thierry
> diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
> index 673a172..8503ae5 100644
> --- a/drivers/pci/controller/pci-tegra.c
> +++ b/drivers/pci/controller/pci-tegra.c
> @@ -1362,10 +1362,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);
> }
>
> static int tegra_pcie_phys_get_legacy(struct tegra_pcie *pcie)
> --
> 2.7.4
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-18 13:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-18 11:11 [PATCH] PCI: tegra: Use PTR_ERR_OR_ZERO() to simplify code zhengbin
2019-11-18 13:19 ` Thierry Reding
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.