negative_error_code: add special handling for negative checks
This code was already using the information from Smatch extra to say that
positive values were not error codes. The issue is that you sometimes
have code like:
int bytes;
long ret = some_function();
if (ret < 0)
return ret;
bytes = ret;
The problem is that bytes is int and ret is long. So smatch thinks that
at the end, if there is a high value of ret it could be truncated into a
negative value in bytes. This isn't going to happen, but that's how Smatch
thinks.
So just make it explicit that if there is a < 0 check the positive values
are not error codes.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>