Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] libbpf: simplify the return expression of build_map_pin_path()
@ 2020-08-18  8:20 Xu Wang
  2020-08-18 15:50 ` Yonghong Song
  2020-08-18 15:51 ` Yonghong Song
  0 siblings, 2 replies; 3+ messages in thread
From: Xu Wang @ 2020-08-18  8:20 UTC (permalink / raw)
  To: ast, daniel, kafai, songliubraving, yhs, andriin, john.fastabend,
	kpsingh, netdev, bpf
  Cc: linux-kernel, Xu Wang

Simplify the return expression.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
 tools/lib/bpf/libbpf.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 5055e1531e43..b423fdaae0b6 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1935,11 +1935,7 @@ static int build_map_pin_path(struct bpf_map *map, const char *path)
 	else if (len >= PATH_MAX)
 		return -ENAMETOOLONG;
 
-	err = bpf_map__set_pin_path(map, buf);
-	if (err)
-		return err;
-
-	return 0;
+	return bpf_map__set_pin_path(map, buf);
 }
 
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libbpf: simplify the return expression of build_map_pin_path()
  2020-08-18  8:20 [PATCH] libbpf: simplify the return expression of build_map_pin_path() Xu Wang
@ 2020-08-18 15:50 ` Yonghong Song
  2020-08-18 15:51 ` Yonghong Song
  1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2020-08-18 15:50 UTC (permalink / raw)
  To: Xu Wang, ast, daniel, kafai, songliubraving, andriin,
	john.fastabend, kpsingh, netdev, bpf
  Cc: linux-kernel



On 8/18/20 1:20 AM, Xu Wang wrote:
> Simplify the return expression.
> 
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
> ---
>   tools/lib/bpf/libbpf.c | 6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 5055e1531e43..b423fdaae0b6 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -1935,11 +1935,7 @@ static int build_map_pin_path(struct bpf_map *map, const char *path)
>   	else if (len >= PATH_MAX)
>   		return -ENAMETOOLONG;
>   
> -	err = bpf_map__set_pin_path(map, buf);
> -	if (err)
> -		return err;
> -
> -	return 0;
> +	return bpf_map__set_pin_path(map, buf);

After the above, the variable `err` will not be used any more, which
may incur an unused variable warning. Could you remove it?

>   }
>   
>   
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libbpf: simplify the return expression of build_map_pin_path()
  2020-08-18  8:20 [PATCH] libbpf: simplify the return expression of build_map_pin_path() Xu Wang
  2020-08-18 15:50 ` Yonghong Song
@ 2020-08-18 15:51 ` Yonghong Song
  1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2020-08-18 15:51 UTC (permalink / raw)
  To: Xu Wang, ast, daniel, kafai, songliubraving, andriin,
	john.fastabend, kpsingh, netdev, bpf
  Cc: linux-kernel



On 8/18/20 1:20 AM, Xu Wang wrote:
> Simplify the return expression.
> 
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>

Also, please tag your patch targeting to 'bpf-next' tree like
[PATCH bpf-next] so people knows which tree the patch targets.

> ---
>   tools/lib/bpf/libbpf.c | 6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 5055e1531e43..b423fdaae0b6 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -1935,11 +1935,7 @@ static int build_map_pin_path(struct bpf_map *map, const char *path)
>   	else if (len >= PATH_MAX)
>   		return -ENAMETOOLONG;
>   
> -	err = bpf_map__set_pin_path(map, buf);
> -	if (err)
> -		return err;
> -
> -	return 0;
> +	return bpf_map__set_pin_path(map, buf);
>   }
>   
>   
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-18 15:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18  8:20 [PATCH] libbpf: simplify the return expression of build_map_pin_path() Xu Wang
2020-08-18 15:50 ` Yonghong Song
2020-08-18 15:51 ` Yonghong Song

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).