PTR_RET does return. It's perfectly equivalent to using IS_ERR and the
returning PTR_ERR. The implementation is here [1]. The reason for using it
is this: if you have a function that does something why not call it instead
of reproducing it's behavior by explicitly writing what it does.

[1] http://lxr.free-electrons.com/source/include/linux/err.h#L55

Alexandru Gheorghiu


On Tue, Mar 26, 2013 at 7:01 AM, Andrew Morton <[email protected]>wrote:

> On Tue, 26 Mar 2013 13:57:09 +1030 Rusty Russell <[email protected]>
> wrote:
>
> > Alexandru Gheorghiu <[email protected]> writes:
> >
> > > Used PTR_RET function instead of IS_ERR and PTR_ERR.
> > > Patch found using coccinelle.
> >
> > WTF is PTR_RET?  PTR_RET doesn't return anything.  Why is it called
> > that?  It doesn't even make sense.
> >
> > ZERO_OR_PTR_ERR() maybe.
> >
> > But what problem are we solving?  Insufficient churn in the tree?  Code
> > being too readable?  This isn't some hard-to-get right corner case, or a
> > missed optimization.
> >
> > Andrew, what am I missing here?
>
> It seemed like a good idea at the time.  Merged it two years ago and
> have since been keenly awaiting an opportunity to use it.
>
> It seems that people _have_ been using it, but mainly netfilter people
> and we know they're all crazy ;)
>
>
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reply via email to