Re: [RFC] PTR_ERR: return 0 if ptr isn't an error value.

2013-06-15 Thread Rusty Russell
Julia Lawall writes: > On Thu, 13 Jun 2013, Michael S. Tsirkin wrote: > >> On Thu, Jun 13, 2013 at 02:07:40PM +0930, Rusty Russell wrote: >> > I think using PTR_ERR() is a less bad solution than promoting PTR_RET, >> > which has a non-obvious name. >> >> Will a longer name make the function more o

Re: [RFC] PTR_ERR: return 0 if ptr isn't an error value.

2013-06-13 Thread Julia Lawall
On Thu, 13 Jun 2013, Michael S. Tsirkin wrote: > On Thu, Jun 13, 2013 at 02:07:40PM +0930, Rusty Russell wrote: > > Julia Lawall writes: > > > On Mon, 3 Jun 2013, Uwe Kleine-König wrote: > > > For a random example, here is a function that currently uses PTR_RET: > > > > Heheh, nice choice: I thin

Re: [RFC] PTR_ERR: return 0 if ptr isn't an error value.

2013-06-13 Thread Michael S. Tsirkin
On Thu, Jun 13, 2013 at 02:07:40PM +0930, Rusty Russell wrote: > Julia Lawall writes: > > On Mon, 3 Jun 2013, Uwe Kleine-König wrote: > > For a random example, here is a function that currently uses PTR_RET: > > Heheh, nice choice: I think I wrote that code originally :) > > > static int __net_i

Re: [RFC] PTR_ERR: return 0 if ptr isn't an error value.

2013-06-12 Thread Rusty Russell
Julia Lawall writes: > On Mon, 3 Jun 2013, Uwe Kleine-König wrote: > For a random example, here is a function that currently uses PTR_RET: Heheh, nice choice: I think I wrote that code originally :) > static int __net_init iptable_raw_net_init(struct net *net) > { > struct ipt_replace *r

Re: [RFC] PTR_ERR: return 0 if ptr isn't an error value.

2013-06-12 Thread Rusty Russell
Uwe Kleine-König writes: > Hello Rusty, > > [added akpm to Cc: who took the patch back then and Julia for the > coccinelle part below] > > On Mon, Jun 03, 2013 at 11:59:15AM +0930, Rusty Russell wrote: >> >> Back in 2011, Uwe Kleine-König added the nonsensically-named >> PTR_RET(), providing a me

Re: [RFC] PTR_ERR: return 0 if ptr isn't an error value.

2013-06-08 Thread Julia Lawall
On Mon, 3 Jun 2013, Uwe Kleine-König wrote: > Hello Rusty, > > [added akpm to Cc: who took the patch back then and Julia for the > coccinelle part below] > > On Mon, Jun 03, 2013 at 11:59:15AM +0930, Rusty Russell wrote: > > > > Back in 2011, Uwe Kleine-König added the nonsensically-named > > P

Re: [RFC] PTR_ERR: return 0 if ptr isn't an error value.

2013-06-03 Thread Uwe Kleine-König
Hello Rusty, [added akpm to Cc: who took the patch back then and Julia for the coccinelle part below] On Mon, Jun 03, 2013 at 11:59:15AM +0930, Rusty Russell wrote: > > Back in 2011, Uwe Kleine-König added the nonsensically-named > PTR_RET(), providing a means to avoid if() statements in code (c

[RFC] PTR_ERR: return 0 if ptr isn't an error value.

2013-06-02 Thread Rusty Russell
Back in 2011, Uwe Kleine-König added the nonsensically-named PTR_RET(), providing a means to avoid if() statements in code (commit fa9ee9c4b9). Instead, just make PTR_ERR() return 0 if the pointer isn't an error value. This is harmless, since PTR_ERR() should have never been passed a non-error