[<prev] [next>] [day] [month] [year] [list]
Message-ID: <87620ecvds.fsf@rustcorp.com.au>
Date: Tue, 26 Mar 2013 20:53:27 +1030
From: Rusty Russell <rusty@...tcorp.com.au>
To: Andru Gheorghiu <gheorghiuandru@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: "Michael S. Tsirkin" <mst@...hat.com>,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
Subject: Re: [PATCH] drivers: virtio: Use PTR_RET function
Andru Gheorghiu <gheorghiuandru@...il.com> writes:
> PTR_RET does return. It's perfectly equivalent to using IS_ERR and the
> returning PTR_ERR. The implementation is here [1].
Um, I read the implementation, thanks.
> 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.
Because clarity matters, and this function makes callers less clear.
It's the most breathtakingly bad name since BUILD_BUG_ON_ZERO().
Why not change PTR_ERR to return 0 if !IS_ERR()? Noone breaks, gcc
probably produces the same code, and noone needs to learn your weird
new kernel meme.
In fact, as gcc will produce the same code for "if (PTR_ERR(p))" as it
does for "if (IS_ERR(p))", you get to be one of the very, very few
people who have ever *reduced* the complexity of a kernel interface.
Cheers,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists