[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <9ec752a8-49e9-40fd-8ed9-fed29d53f37b@web.de>
Date: Fri, 20 Sep 2024 14:24:50 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: netdev@...r.kernel.org, Christian Marangi <ansuelsmth@...il.com>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Nick Child <nnac123@...ux.ibm.com>, Paolo Abeni <pabeni@...hat.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Taku Izumi <izumi.taku@...fujitsu.com>,
Uwe Kleine-König <u.kleine-koenig@...libre.com>,
Yasuaki Ishimatsu <isimatu.yasuaki@...fujitsu.com>
Cc: LKML <linux-kernel@...r.kernel.org>, Julia Lawall
<julia.lawall@...ia.fr>, Yasuaki Ishimatsu <yasu.isimatu@...il.com>
Subject: [PATCH] net: fjes: Refactor a string comparison in
is_extended_socket_device()
From: Markus Elfring <elfring@...rs.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@...rs.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
Powered by blists - more mailing lists