All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: Duan Jiong <duanj.fnst@cn.fujitsu.com>,
	thierry.reding@gmail.com, bhelgaas@google.com
Cc: linux-tegra@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH] ARM: tegra: replace IS_ERR and PTR_ERR with PTR_ERR_OR_ZERO
Date: Fri, 11 Apr 2014 09:46:37 -0600	[thread overview]
Message-ID: <53480E5D.1060809@wwwdotorg.org> (raw)
In-Reply-To: <1397203000-16586-1-git-send-email-duanj.fnst@cn.fujitsu.com>

On 04/11/2014 01:56 AM, Duan Jiong wrote:
> This patch fixes coccinelle error regarding usage of IS_ERR and
> PTR_ERR instead of PTR_ERR_OR_ZERO.

> diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c

> @@ -1024,10 +1024,7 @@ static int tegra_pcie_resets_get(struct tegra_pcie *pcie)
>  		return PTR_ERR(pcie->afi_rst);
>  
>  	pcie->pcie_xrst = devm_reset_control_get(pcie->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);
>  }

To be honest, I prefer the existing code. If we needed to add some more
code between the call to devm_reset_control_get() and the return
statement, the diff would be much cleaner if the error-handling path and
the regular return path were kept separate, as they are today.

Why is coccinelle throwing an error? The compiler likely makes identical
code for both source representations.

      reply	other threads:[~2014-04-11 15:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-11  7:56 [PATCH] ARM: tegra: replace IS_ERR and PTR_ERR with PTR_ERR_OR_ZERO Duan Jiong
2014-04-11  7:56 ` Duan Jiong
2014-04-11 15:46 ` Stephen Warren [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=53480E5D.1060809@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=bhelgaas@google.com \
    --cc=duanj.fnst@cn.fujitsu.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@gmail.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 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.