lkml.org 
[lkml]   [2015]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] staging: lustre: Less function calls in class_register_type() after error detection
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


\
 
 \ /
  Last update: 2015-11-26 21:21    [W:0.791 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site