zero_to_err_ptr: silence some false positives
commit11d627f2279b836d0c4e624d4ca0f6c665971fd2
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 7 Oct 2022 12:20:23 +0000 (7 15:20 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Fri, 7 Oct 2022 12:20:23 +0000 (7 15:20 +0300)
tree4818e9ddfb2c6449a9eae149c62527c6f1defa01
parent0128c38f64e0a74555d472507ccf9e56abc06408
zero_to_err_ptr: silence some false positives

Doing "return PTR_ERR(p);" when "p" is NULL is a perfectly valid thing to
do.  However, although it can be valid, most of the time, it is a bug.
Hence this check.

However, when people use the PTR_ERR(p) as part of a condition:

if (PTR_ERR(p) == -ENOMEM) {

then most of those uses are valid so don't print a warning about those.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
check_zero_to_err_ptr.c