diff mbox series

[v2,1/2] swupdate: drop unnecessary strlen check

Message ID 20190704100840.13013-2-mk@mkio.de
State Changes Requested
Headers show
Series [v2,1/2] swupdate: drop unnecessary strlen check | expand

Commit Message

Markus Klotzbuecher July 4, 2019, 10:08 a.m. UTC
From: Markus Klotzbuecher <markus.klotzbuecher@kistler.com>

When using strcmp to compare two strings, it is not necessary to check
beforehand that they are of equal length.

Signed-off-by: Markus Klotzbuecher <markus.klotzbuecher@kistler.com>
---
 core/util.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/core/util.c b/core/util.c
index 3194eab..5724b4c 100644
--- a/core/util.c
+++ b/core/util.c
@@ -297,8 +297,7 @@  int check_hw_compatibility(struct swupdate_cfg *cfg)
 
 	TRACE("Hardware %s Revision: %s", cfg->hw.boardname, cfg->hw.revision);
 	LIST_FOREACH(hw, &cfg->hardware, next) {
-		if (hw && strlen(hw->revision) == strlen(cfg->hw.revision) &&
-				(!strcmp(hw->revision, cfg->hw.revision))) {
+		if (hw && (!strcmp(hw->revision, cfg->hw.revision))) {
 			TRACE("Hardware compatibility verified");
 			return 0;
 		}