Re: [PATCH 2/3] bcachefs: chardev: fix NULL vs IS_ERR() checks

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

 



On Thu, Sep 14, 2023 at 03:56:04PM -0400, Kent Overstreet wrote:
> On Thu, Sep 14, 2023 at 05:58:48PM +0300, Dan Carpenter wrote:
> > The strndup_user() function returns error pointers on error.  It never
> > returns NULL.  Fix the checks including the commented out code.
> 
> My preferred style in bcachefs is
> 
> ret = PTR_ERR_OR_ZERO(p);
> if (ret)
> 	return ret;
> 
> It keeps things consistent when we're doing a goto err instead of a
> return.

So you want people to write:

	path = strndup_user();
	ret = PTR_ERR_OR_ZERO(p);
	if (ret)
		goto err;

I don't want people to look at the git log and see me writing code like
that.  :P  You're going to have to do that yourself.  That's yuck.

regards,
dan carpenter



[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