All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin King <colin.king@canonical.com>
To: kernel-janitors@vger.kernel.org
Subject: [PATCH] cpu: microcode: remove redundant check on pointer entry
Date: Sat, 07 Dec 2019 15:33:43 +0000	[thread overview]
Message-ID: <20191207153343.112887-1-colin.king@canonical.com> (raw)

From: Colin Ian King <colin.king@canonical.com>

The check for a null entry is redundant as the while loop
also checks for this.  Remove the redundant check. Cleans
up cppcheck style warning:

src/cpu/microcode/microcode.c:203:14: style: Condition 'entry' is
always true [knownConditionTrueFalse]
         if (entry &&

src/cpu/microcode/microcode.c:202:32: note: Assuming that condition
'(entry=readdir(dir))!=NULL' is not redundant

 while ((entry = readdir(dir)) != NULL) {

src/cpu/microcode/microcode.c:203:14: note: Condition 'entry' is
always true
         if (entry &&

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/cpu/microcode/microcode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/cpu/microcode/microcode.c b/src/cpu/microcode/microcode.c
index 974fdec9..65abe50a 100644
--- a/src/cpu/microcode/microcode.c
+++ b/src/cpu/microcode/microcode.c
@@ -200,8 +200,7 @@ static int microcode_test1(fwts_framework *fw)
 
 	/* Scan and check */
 	while ((entry = readdir(dir)) != NULL) {
-	        if (entry &&
-		    (strlen(entry->d_name) > 3) &&
+	        if ((strlen(entry->d_name) > 3) &&
 		    (strncmp(entry->d_name,"cpu", 3) = 0) &&
 		    (isdigit(entry->d_name[3]))) {
 			char path[PATH_MAX];
-- 
2.24.0

             reply	other threads:[~2019-12-07 15:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-07 15:33 Colin King [this message]
2019-12-07 15:39 ` [PATCH] cpu: microcode: remove redundant check on pointer entry Colin Ian King

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=20191207153343.112887-1-colin.king@canonical.com \
    --to=colin.king@canonical.com \
    --cc=kernel-janitors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.