Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1278423

Re: [PATCH 3/3] staging: lustre: Less function calls in class_register_type() after error detection

From Dan Carpenter <dan.carpenter@oracle.com>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] staging: lustre: Less function calls in class_register_type() after error detection
Date 2015-11-26 21:10 +0100
Message-ID <qzb1D-1pH-3@gated-at.bofh.it> (permalink)
References (5 earlier) <qrrPX-6Ed-3@gated-at.bofh.it> <qyLgS-jU-25@gated-at.bofh.it> <qyYQP-1zw-33@gated-at.bofh.it> <qz83M-7Nx-7@gated-at.bofh.it> <qza5A-Qe-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


These patches are often correct in the same way a stopped clock is
correct twice a day, but I reject the motivation/approach/patch
description.  Just because there is a sanity check does not mean we
should use it (ie, do an insane thing).  It hurts readability to hide
the NULL check.

On the other hand, half the time the NULL checks are superflous because
the pointer is never NULL.  The other half of the time the NULL checks
are there because the code uses one err style error handling.  Also the
error handling code should mirror the allocation code so I feel like it
should be:

	if (some_feature)
		foo = allocate();
	ret = frob();
	if (ret)
		goto free_foo;

free_foo:
	if (some_feature)  // <--- as opposed to if (foo) {
		free(foo);

So anyway I often don't like the original code, but the new code is
even worse and I have never heard a good motivation for these patches
besides that they were generated using a cool tool.  It's not a good
reason.  Other maintainers are accepting these patches so you are free
to send them there.

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH 3/3] staging: lustre: Less function calls in  class_register_type() after error detection Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-11-25 17:40 +0100
  Re: [PATCH 3/3] staging: lustre: Less function calls in  class_register_type() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-26 08:10 +0100
    Re: [PATCH 3/3] staging: lustre: Less function calls in  class_register_type() after error detection Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-11-26 18:00 +0100
      Re: [PATCH 3/3] staging: lustre: Less function calls in  class_register_type() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-26 20:10 +0100
        Re: [PATCH 3/3] staging: lustre: Less function calls in  class_register_type() after error detection Dan Carpenter <dan.carpenter@oracle.com> - 2015-11-26 21:10 +0100

csiph-web