From fbf14fe84b3e0ab6af921dc28f4d8455a77bbcbc Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sun, 2 Dec 2018 23:12:48 +0000 Subject: [PATCH] Return after we find the dispatched function. If the dispatched function doesn't exit, then we get can get a spurious function not found message. They all do exit, but this is a little cleaner. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 --- sbin/nvmecontrol/nvmecontrol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/nvmecontrol.c b/sbin/nvmecontrol/nvmecontrol.c index d67f8999995e..c4ac0f507f80 100644 --- a/sbin/nvmecontrol/nvmecontrol.c +++ b/sbin/nvmecontrol/nvmecontrol.c @@ -73,8 +73,10 @@ dispatch_set(int argc, char *argv[], struct nvme_function **tbl, } while (f < tbl_limit) { - if (strcmp(argv[1], (*f)->name) == 0) + if (strcmp(argv[1], (*f)->name) == 0) { (*f)->fn(argc-1, &argv[1]); + return; + } f++; }