Re: useless variable initializations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25/03/2008, Julia Lawall <julia@xxxxxxx> wrote:
> Is there any policy about useless variable intializations, such as:
>
>  struct foo *x = NULL;
>  ...
>  x = kmalloc(...);
>
>  where the original value of x is never used?
>
>
>  Another example is (fs/nfs/client.c):
>
>  struct rpc_clnt *clnt = NULL;
>  ...
>  clnt = rpc_create(&args);
>
>  This could actually be slightly misleading, because rpc_create returns
>  either a valid pointer or a value created with ERR_PTR, never NULL, so
>  NULL is not really in the set of reasonable values for clnt.
>
I've submitted a few cleanup patches in the past that removed such
obviously pointless initialization and they have generally been
accepted.

-- 
Jesper Juhl <jesper.juhl@xxxxxxxxx>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux