From: Thierry Reding <thierry.reding@gmail.com>
To: zhengbin <zhengbin13@huawei.com>
Cc: lorenzo.pieralisi@arm.com, andrew.murray@arm.com,
bhelgaas@google.com, jonathanh@nvidia.com,
linux-tegra@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI: tegra: Use PTR_ERR_OR_ZERO() to simplify code
Date: Mon, 18 Nov 2019 14:19:53 +0100 [thread overview]
Message-ID: <20191118131953.GA2246533@ulmo> (raw)
In-Reply-To: <1574075478-41136-1-git-send-email-zhengbin13@huawei.com>
[-- 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 --]
prev parent reply other threads:[~2019-11-18 13:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191118131953.GA2246533@ulmo \
--to=thierry.reding@gmail.com \
--cc=andrew.murray@arm.com \
--cc=bhelgaas@google.com \
--cc=jonathanh@nvidia.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=zhengbin13@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).