Powered by Linux
[PATCH] check_checking_for_null_instead_of_err_ptr: Save a few cycles — Semantic Matching Tool

[PATCH] check_checking_for_null_instead_of_err_ptr: Save a few cycles

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



No need to register a hook and make some tests if it ends to not reporting
anything because an option is not se .

Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
---
 check_checking_for_null_instead_of_err_ptr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/check_checking_for_null_instead_of_err_ptr.c b/check_checking_for_null_instead_of_err_ptr.c
index d9498dce2de4..936eefbac8ba 100644
--- a/check_checking_for_null_instead_of_err_ptr.c
+++ b/check_checking_for_null_instead_of_err_ptr.c
@@ -121,8 +121,7 @@ static void match_condition2(struct expression *expr)
 
 warn:
 	name = expr_to_str(expr);
-	if (option_spammy)
-		sm_warning("'%s' could be an error pointer", name);
+	sm_warning("'%s' could be an error pointer", name);
 	free_string(name);
 }
 
@@ -179,7 +178,8 @@ void check_checking_for_null_instead_of_err_ptr(int id)
 	my_id = id;
 	register_err_ptr_funcs();
 	add_hook(&match_condition, CONDITION_HOOK);
-	add_hook(&match_condition2, CONDITION_HOOK);
+	if (option_spammy)
+		add_hook(&match_condition2, CONDITION_HOOK);
 	add_modification_hook(my_id, &ok_to_use);
 	register_ignored_macros();
 }
-- 
2.34.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux