[PATCH v2] tpm: "qemu -tpmdev help" should return success

marcandre.lureau@redhat.com posted 1 patch 5 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250707101412.2055581-1-marcandre.lureau@redhat.com
Maintainers: Stefan Berger <stefanb@linux.vnet.ibm.com>
system/tpm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
[PATCH v2] tpm: "qemu -tpmdev help" should return success
Posted by marcandre.lureau@redhat.com 5 months, 2 weeks ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

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>
---
 system/tpm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/system/tpm.c b/system/tpm.c
index 8df0f6e72b..903b29c043 100644
--- a/system/tpm.c
+++ b/system/tpm.c
@@ -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) {
-- 
2.50.0


Re: [PATCH v2] tpm: "qemu -tpmdev help" should return success
Posted by Philippe Mathieu-Daudé 5 months, 2 weeks ago
On 7/7/25 12:14, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> 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>
> ---
>   system/tpm.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>


Re: [PATCH v2] tpm: "qemu -tpmdev help" should return success
Posted by Peter Maydell 5 months, 2 weeks ago
On Mon, 7 Jul 2025 at 11:14, <marcandre.lureau@redhat.com> wrote:
>
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> 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>

thanks
-- PMM