lkml.org 
[lkml]   [2008]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/6] ERR_PTR: add ERR_OR_0_PTR
On Mon, May 19, 2008 at 07:55:04AM +0200, Christoph Hellwig wrote:
> On Mon, May 19, 2008 at 12:01:07AM +0200, Marcin Slusarz wrote:
> > Some codepaths call ERR_PTR with possibly 0 argument, which is not
> > a valid errno and rely on conversion from 0 to NULL pointer.
> > Add ERR_OR_0_PTR function which accepts errnos and 0 as an argument.
>
> Sorry, no. ERR_PTR(0) is perfectly valid, you just don't want to return
> the actualy value. E.g. we have a common idiom of:
>
> some_ptr = ERR_PTR(err);
> if (IS_ERR(some_ptr))
> goto out_handle_err;
>
> and obsfucating this with new syntactic sugar is not a good idea.

Um... Could somebody explain WTF is wrong with declaring that ERR_PTR(0)
is NULL? Sure, if we run into a target where converting non-constant
integer with value zero to void * does not result in null pointer, we'll
need to adjust ERR_PTR(). So. Fscking. What?
a) it's not a lot of adjustment, to start with
b) any such target will require much more work on porting anyway;
this part will be trivial.


\
 
 \ /
  Last update: 2008-05-19 08:37    [W:0.035 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site