[PATCH] tools: kmod: break iteration once a command is executed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 tools/kmod.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/kmod.c b/tools/kmod.c
index abb1707..a8534cd 100644
--- a/tools/kmod.c
+++ b/tools/kmod.c
@@ -124,10 +124,10 @@ static int handle_kmod_commands(int argc, char *argv[])
 	cmd = argv[optind];
 
 	for (i = 0, err = -EINVAL; i < ARRAY_SIZE(kmod_cmds); i++) {
-		if (strcmp(kmod_cmds[i]->name, cmd) != 0)
-			continue;
-
-		err = kmod_cmds[i]->cmd(--argc, ++argv);
+		if (strcmp(kmod_cmds[i]->name, cmd) == 0) {
+			err = kmod_cmds[i]->cmd(--argc, ++argv);
+			break;
+		}
 	}
 
 	if (err < 0) {
-- 
2.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux