Re: [PATCH] security: keys: remove redundant assignment to key_ref

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

 




On Wed, 6 Dec 2017, David Howells wrote:

> James Morris <james.l.morris@xxxxxxxxxx> wrote:
>
> > I think a general cleanup in that function to make all of these follow the
> > pattern:
> >
> > 	if (something) {
> > 		key_ref = ERR_PTR(-error);
> > 		goto error;
> > 	}
> >
> > rather than unconditionally setting the error first, would be better, but
> > this is a clear enough fix on its own.
>
> There's a preference in Linux to use:
>
> 	key_ref = ERR_PTR(-error);
>  	if (something)
>  		goto error;
>
> instead because it uses less vertical space.  It might originally have been
> promulgated by Linus, but I don't remember.  Though you do have a point - your
> way makes error handling less subject breakage from code rearrangement.

I have the impression that there are many examples of both approaches.

julia

>
> David
> --
> 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
>
--
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