]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tpm: "qemu -tpmdev help" should return success
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 7 Jul 2025 10:14:12 +0000 (14:14 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 15 Jul 2025 06:22:33 +0000 (10:22 +0400)
Like other "-foo help" CLI, the qemu process should return 0 for
"-tpmdev help".

While touching this, switch to is_help_option() utility function as
suggested by Peter Maydell.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250707101412.2055581-1-marcandre.lureau@redhat.com>

system/tpm.c

index 8df0f6e72b3491d5cfc29fb405620aee059809dd..903b29c0437bb423f74b0d6713d62b32b13e784f 100644 (file)
@@ -21,6 +21,7 @@
 #include "system/tpm.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
+#include "qemu/help_option.h"
 
 static QLIST_HEAD(, TPMBackend) tpm_backends =
     QLIST_HEAD_INITIALIZER(tpm_backends);
@@ -179,9 +180,9 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optstr)
 {
     QemuOpts *opts;
 
-    if (!strcmp(optstr, "help")) {
+    if (is_help_option(optstr)) {
         tpm_display_backend_drivers();
-        return -1;
+        exit(EXIT_SUCCESS);
     }
     opts = qemu_opts_parse_noisily(opts_list, optstr, true);
     if (!opts) {