smatch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: smatch@vger.kernel.org
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Subject: [PATCH] check_checking_for_null_instead_of_err_ptr: Save a few cycles
Date: Mon, 30 May 2022 22:02:10 +0200	[thread overview]
Message-ID: <96f2bc8842a916552756fa0bc625d948aa5887a8.1653940924.git.christophe.jaillet@wanadoo.fr> (raw)

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@wanadoo.fr>
---
 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

                 reply	other threads:[~2022-05-30 20:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=96f2bc8842a916552756fa0bc625d948aa5887a8.1653940924.git.christophe.jaillet@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=smatch@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).