missing_error_code2: warn about return ret where ret is zero
This is for code like:
ret = frob();
if (ret)
return ret;
if (len != 10)
return ret;
Sometimes (quite often maybe?) the code really is supposed to return 0 but
often it's supposed to return an error code. Even if zero is intended it's
more readable to return a literal zero instead of "ret".
This will not warn about code like:
ret = frob();
if (!ret)
return ret;
I have an unpublished check for code like that. Those are normally
intentional but the canonical bug for that type of code is a reversed if
statement where the "!" was unintentional. I feel like "return 0;" is
much better code in these cases as well, but I don't like getting into
draining style debates when there are so many real bugs which I don't
have time to fix.
Signed-off-by: Dan Carpenter <error27@gmail.com>