* [PATCH] net: fjes: Refactor a string comparison in is_extended_socket_device()
@ 2024-09-20 12:24 Markus Elfring
2024-09-22 17:08 ` Simon Horman
0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2024-09-20 12:24 UTC (permalink / raw)
To: netdev, Christian Marangi, David S. Miller, Eric Dumazet,
Jakub Kicinski, Krzysztof Kozlowski, Nick Child, Paolo Abeni,
Rafael J. Wysocki, Taku Izumi, Uwe Kleine-König,
Yasuaki Ishimatsu
Cc: LKML, Julia Lawall, Yasuaki Ishimatsu
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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] net: fjes: Refactor a string comparison in is_extended_socket_device()
2024-09-20 12:24 [PATCH] net: fjes: Refactor a string comparison in is_extended_socket_device() Markus Elfring
@ 2024-09-22 17:08 ` Simon Horman
0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2024-09-22 17:08 UTC (permalink / raw)
To: Markus Elfring
Cc: netdev, Christian Marangi, David S. Miller, Eric Dumazet,
Jakub Kicinski, Krzysztof Kozlowski, Nick Child, Paolo Abeni,
Rafael J. Wysocki, Taku Izumi, Uwe Kleine-König,
Yasuaki Ishimatsu, LKML, Julia Lawall, Yasuaki Ishimatsu
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.
--
pw-bot: rejected
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-22 17:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-20 12:24 [PATCH] net: fjes: Refactor a string comparison in is_extended_socket_device() Markus Elfring
2024-09-22 17:08 ` Simon Horman
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 NNTP newsgroup(s).