[-next] bpf: Use PTR_ERR_OR_ZERO in xsk_map_inc()
diff mbox series

Message ID 20190820013652.147041-1-yuehaibing@huawei.com
State Accepted
Delegated to: BPF Maintainers
Headers show
Series
  • [-next] bpf: Use PTR_ERR_OR_ZERO in xsk_map_inc()
Related show

Commit Message

Yuehaibing Aug. 20, 2019, 1:36 a.m. UTC
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 kernel/bpf/xskmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Björn Töpel Aug. 20, 2019, 7:28 a.m. UTC | #1
On 2019-08-20 03:36, YueHaibing wrote:
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>   kernel/bpf/xskmap.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/bpf/xskmap.c b/kernel/bpf/xskmap.c
> index 4cc28e226398..942c662e2eed 100644
> --- a/kernel/bpf/xskmap.c
> +++ b/kernel/bpf/xskmap.c
> @@ -21,7 +21,7 @@ int xsk_map_inc(struct xsk_map *map)
>   	struct bpf_map *m = &map->map;
>   
>   	m = bpf_map_inc(m, false);
> -	return IS_ERR(m) ? PTR_ERR(m) : 0;
> +	return PTR_ERR_OR_ZERO(m);
>   }
>   
>   void xsk_map_put(struct xsk_map *map)
>

Acked-by: Björn Töpel <bjorn.topel@intel.com>

Thanks for the patch!

For future patches: Prefix AF_XDP socket work with "xsk:" and use "PATCH
bpf-next" to let the developers know what tree you're aiming for.



Cheers!
Björn


> 
>
Dan Carpenter Aug. 20, 2019, 8:55 a.m. UTC | #2
On Tue, Aug 20, 2019 at 09:28:26AM +0200, Björn Töpel wrote:
> For future patches: Prefix AF_XDP socket work with "xsk:" and use "PATCH
> bpf-next" to let the developers know what tree you're aiming for.

There are over 300 trees in linux-next.  It impossible to try remember
everyone's trees.  No one else has this requirement.

Maybe add it as an option to get_maintainer.pl --tree <hash> then that
would be very easy.

regards,
dan carpenter
Björn Töpel Aug. 20, 2019, 9:25 a.m. UTC | #3
On Tue, 20 Aug 2019 at 10:59, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> On Tue, Aug 20, 2019 at 09:28:26AM +0200, Björn Töpel wrote:
> > For future patches: Prefix AF_XDP socket work with "xsk:" and use "PATCH
> > bpf-next" to let the developers know what tree you're aiming for.
>
> There are over 300 trees in linux-next.  It impossible to try remember
> everyone's trees.  No one else has this requirement.
>

Net/bpf are different, and I wanted to point that out to lessen the
burden for the maintainers. It's documented in:

Documentation/bpf/bpf_devel_QA.rst.
Documentation/networking/netdev-FAQ.rst

> Maybe add it as an option to get_maintainer.pl --tree <hash> then that
> would be very easy.
>

Yes, improved tooling would help.


Cheers,
Björn

> regards,
> dan carpenter
>
Dan Carpenter Aug. 20, 2019, 9:44 a.m. UTC | #4
On Tue, Aug 20, 2019 at 11:25:29AM +0200, Björn Töpel wrote:
> On Tue, 20 Aug 2019 at 10:59, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > On Tue, Aug 20, 2019 at 09:28:26AM +0200, Björn Töpel wrote:
> > > For future patches: Prefix AF_XDP socket work with "xsk:" and use "PATCH
> > > bpf-next" to let the developers know what tree you're aiming for.
> >
> > There are over 300 trees in linux-next.  It impossible to try remember
> > everyone's trees.  No one else has this requirement.
> >
> 
> Net/bpf are different, and I wanted to point that out to lessen the
> burden for the maintainers. It's documented in:
> 
> Documentation/bpf/bpf_devel_QA.rst.
> Documentation/networking/netdev-FAQ.rst

Ah...  I hadn't realized that BPF patches were confusing to Dave.

I actually do keep track of net and net-next.  I do quite a bit of extra
stuff for netdev patches.  So what about if we used [PATCH] for bpf and
[PATCH net] and [PATCH net-next] for networking?

I will do that.

regards,
dan carpenter
Yuehaibing Aug. 20, 2019, 11:46 a.m. UTC | #5
On 2019/8/20 17:44, Dan Carpenter wrote:
> On Tue, Aug 20, 2019 at 11:25:29AM +0200, Björn Töpel wrote:
>> On Tue, 20 Aug 2019 at 10:59, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>>>
>>> On Tue, Aug 20, 2019 at 09:28:26AM +0200, Björn Töpel wrote:
>>>> For future patches: Prefix AF_XDP socket work with "xsk:" and use "PATCH
>>>> bpf-next" to let the developers know what tree you're aiming for.
>>>
>>> There are over 300 trees in linux-next.  It impossible to try remember
>>> everyone's trees.  No one else has this requirement.
>>>
>>
>> Net/bpf are different, and I wanted to point that out to lessen the
>> burden for the maintainers. It's documented in:
>>
>> Documentation/bpf/bpf_devel_QA.rst.
>> Documentation/networking/netdev-FAQ.rst
> 
> Ah...  I hadn't realized that BPF patches were confusing to Dave.
> 
> I actually do keep track of net and net-next.  I do quite a bit of extra
> stuff for netdev patches.  So what about if we used [PATCH] for bpf and
> [PATCH net] and [PATCH net-next] for networking?
> 
> I will do that.

bpf-next is a good choice.

> 
> regards,
> dan carpenter
> 
> .
>
Daniel Borkmann Aug. 20, 2019, 3:09 p.m. UTC | #6
On 8/20/19 3:36 AM, YueHaibing wrote:
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Applied, thanks!

Patch
diff mbox series

diff --git a/kernel/bpf/xskmap.c b/kernel/bpf/xskmap.c
index 4cc28e226398..942c662e2eed 100644
--- a/kernel/bpf/xskmap.c
+++ b/kernel/bpf/xskmap.c
@@ -21,7 +21,7 @@  int xsk_map_inc(struct xsk_map *map)
 	struct bpf_map *m = &map->map;
 
 	m = bpf_map_inc(m, false);
-	return IS_ERR(m) ? PTR_ERR(m) : 0;
+	return PTR_ERR_OR_ZERO(m);
 }
 
 void xsk_map_put(struct xsk_map *map)