diff mbox series

net: fjes: Refactor a string comparison in is_extended_socket_device()

Message ID 9ec752a8-49e9-40fd-8ed9-fed29d53f37b@web.de (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series net: fjes: Refactor a string comparison in is_extended_socket_device() | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: elfring@users.sourceforge.net
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 33 this patch: 33
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-09-20--15-00 (tests: 764)

Commit Message

Markus Elfring Sept. 20, 2024, 12:24 p.m. UTC
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(-)

--
2.46.0

Comments

Simon Horman Sept. 22, 2024, 5:08 p.m. UTC | #1
On Fri, Sep 20, 2024 at 02:24:50PM +0200, Markus Elfring wrote:
> 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>

Hi Markus,

This is an old driver, that doesn't appear to have been under active
development for quite some time.  And I don't think that clean-ups of this
nature are worth the risk of regressions they might introduce.

If we can see bugs, let's fix them.
Else, let's leave it be.
diff mbox series

Patch

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)