[PATCH] 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/20250707095550.2049280-1-marcandre.lureau@redhat.com
Maintainers: Stefan Berger <stefanb@linux.vnet.ibm.com>
There is a newer version of this series
system/tpm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] 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".

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 system/tpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/system/tpm.c b/system/tpm.c
index 8df0f6e72b..5f12a62c4a 100644
--- a/system/tpm.c
+++ b/system/tpm.c
@@ -181,7 +181,7 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optstr)
 
     if (!strcmp(optstr, "help")) {
         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] tpm: "qemu -tpmdev help" should return success
Posted by Peter Maydell 5 months, 2 weeks ago
On Mon, 7 Jul 2025 at 10:57, <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".
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  system/tpm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/system/tpm.c b/system/tpm.c
> index 8df0f6e72b..5f12a62c4a 100644
> --- a/system/tpm.c
> +++ b/system/tpm.c
> @@ -181,7 +181,7 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optstr)
>
>      if (!strcmp(optstr, "help")) {

We have an is_help_option() utility function for this, incidentally.

>          tpm_display_backend_drivers();
> -        return -1;
> +        exit(EXIT_SUCCESS);
>      }
>      opts = qemu_opts_parse_noisily(opts_list, optstr, true);
>      if (!opts) {
> --
> 2.50.0

thanks
-- PMM