From: Markus Elfring <Markus.Elfring@web.de>
To: netdev@vger.kernel.org,
"Christian Marangi" <ansuelsmth@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>,
"Nick Child" <nnac123@linux.ibm.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
"Taku Izumi" <izumi.taku@jp.fujitsu.com>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Yasuaki Ishimatsu" <isimatu.yasuaki@jp.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Julia Lawall <julia.lawall@inria.fr>,
Yasuaki Ishimatsu <yasu.isimatu@gmail.com>
Subject: [PATCH] net: fjes: Refactor a string comparison in is_extended_socket_device()
Date: Fri, 20 Sep 2024 14:24:50 +0200 [thread overview]
Message-ID: <9ec752a8-49e9-40fd-8ed9-fed29d53f37b@web.de> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 20 Sep 2024 13:56:44 +0200
Assign the return value from a strncmp() call to a local variable
so that an if statement can be omitted accordingly.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/net/fjes/fjes_main.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c
index fad5b6564464..1fae30798899 100644
--- a/drivers/net/fjes/fjes_main.c
+++ b/drivers/net/fjes/fjes_main.c
@@ -54,13 +54,9 @@ static bool is_extended_socket_device(struct acpi_device *device)
str_buf, sizeof(str_buf) - 1);
str_buf[result] = 0;
- if (strncmp(FJES_ACPI_SYMBOL, str_buf, strlen(FJES_ACPI_SYMBOL)) != 0) {
- kfree(buffer.pointer);
- return false;
- }
+ result = strncmp(FJES_ACPI_SYMBOL, str_buf, strlen(FJES_ACPI_SYMBOL));
kfree(buffer.pointer);
-
- return true;
+ return result == 0;
}
static int acpi_check_extended_socket_status(struct acpi_device *device)
--
2.46.0
next reply other threads:[~2024-09-20 12:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-20 12:24 Markus Elfring [this message]
2024-09-22 17:08 ` Simon Horman
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=9ec752a8-49e9-40fd-8ed9-fed29d53f37b@web.de \
--to=markus.elfring@web.de \
--cc=ansuelsmth@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=izumi.taku@jp.fujitsu.com \
--cc=julia.lawall@inria.fr \
--cc=krzysztof.kozlowski@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nnac123@linux.ibm.com \
--cc=pabeni@redhat.com \
--cc=rafael.j.wysocki@intel.com \
--cc=u.kleine-koenig@baylibre.com \
--cc=yasu.isimatu@gmail.com \
/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
all inboxes | Powered by JetHome®