Re: [PATCH v11 3/4] add FPGA manager core
From: Dan Carpenter
Date: Thu Sep 24 2015 - 03:52:15 EST
Of course, the maintainer gets the last word regardless of what anyone
else thinks.
Generally, minimal code is better. Trying to future proof code is a
waste of time because you can't predict what will happen in the future.
It's way more likely that some pointer you never expected to be NULL
will be NULL instead of the few checked at the beginning of a function.
Adding useless code uses RAM and makes the function slower. It's a bit
confusing for users as well because they will wonder when the NULL check
is used. A lot of times this sort of error handling is a bit fake and
what I mean is that it looks correct but the system will just crash in a
later function.
Also especially with a simple NULL dereferences like this theoretical
one, it's better to just get the oops. It kills the module but you get
a good message in the log and it's normally straight forward to debug.
We spent a surprising amount of time discussing useless code. I made
someone redo a patch yesterday because they had incomplete error
handling for a situation which could never happen.
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/