public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: zhong jiang <zhongjiang@huawei.com>
To: <ast@kernel.org>, <daniel@iogearbox.net>, <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] lib/bpf/libbpf: Simplify the code by using PTR_ERR_OR_ZERO
Date: Wed, 1 Aug 2018 09:18:50 +0800	[thread overview]
Message-ID: <5B610A7A.5000909@huawei.com> (raw)
In-Reply-To: <1533054656-36134-1-git-send-email-zhongjiang@huawei.com>

On 2018/8/1 0:30, zhong jiang wrote:
> Use PTR_ERR_OR_ZERO is better than the open code.
>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  tools/lib/bpf/libbpf.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 40211b5..9b61468 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -2271,9 +2271,7 @@ struct bpf_map *
>  
>  long libbpf_get_error(const void *ptr)
>  {
> -	if (IS_ERR(ptr))
> -		return PTR_ERR(ptr);
> -	return 0;
> +	return PTR_ERR_OR_ZERO(ptr);
>  }
>  
>  int bpf_prog_load(const char *file, enum bpf_prog_type type,
I am so sorry for that.  I will repost it after check it correct carefully.

Thanks
zhong jiang


      parent reply	other threads:[~2018-08-01  1:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-31 16:30 [PATCH] lib/bpf/libbpf: Simplify the code by using PTR_ERR_OR_ZERO zhong jiang
2018-07-31 21:11 ` Daniel Borkmann
2018-08-01  1:18 ` zhong jiang [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=5B610A7A.5000909@huawei.com \
    --to=zhongjiang@huawei.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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