qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH for-5.1 2/2] tpm: Improve help on TPM types when none are available
Date: Thu, 23 Jul 2020 10:22:01 -0400	[thread overview]
Message-ID: <e0270711-f453-fa99-dc2e-74032b24118c@linux.ibm.com> (raw)
In-Reply-To: <42246b2f-e267-b254-10cf-0dc491d5f99e@redhat.com>

On 7/23/20 8:49 AM, Philippe Mathieu-Daudé wrote:
> On 7/23/20 1:58 PM, Markus Armbruster wrote:
>> Help is a bit awkward when no TPM types are built into QEMU:
>>
>>      $ upstream-qemu -tpmdev nonexistent,id=tpm0
>>      upstream-qemu: -tpmdev nonexistent,id=tpm0: Parameter 'type' expects a TPM backend type
>>      Supported TPM types (choose only one):
>>
>> Improve to
>>
>>      upstream-qemu: -tpmdev nonexistent,id=tpm0: Parameter 'type' expects a TPM backend type
>>      No TPM backend types are available
>>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>


>
>> ---
>>   tpm.c | 13 +++++++++----
>>   1 file changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/tpm.c b/tpm.c
>> index f6045bb6da..cab206355a 100644
>> --- a/tpm.c
>> +++ b/tpm.c
>> @@ -47,18 +47,23 @@ tpm_be_find_by_type(enum TpmType type)
>>    */
>>   static void tpm_display_backend_drivers(void)
>>   {
>> +    bool got_one = false;
>>       int i;
>>   
>> -    fprintf(stderr, "Supported TPM types (choose only one):\n");
>> -
>>       for (i = 0; i < TPM_TYPE__MAX; i++) {
>>           const TPMBackendClass *bc = tpm_be_find_by_type(i);
>>           if (!bc) {
>>               continue;
>>           }
>> -        fprintf(stderr, "%12s   %s\n", TpmType_str(i), bc->desc);
>> +        if (!got_one) {
>> +            error_printf("Supported TPM types (choose only one):\n");
>> +            got_one = true;
>> +        }
>> +        error_printf("%12s   %s\n", TpmType_str(i), bc->desc);
>> +    }
>> +    if (!got_one) {
>> +        error_printf("No TPM backend types are available\n");
>>       }
>> -    fprintf(stderr, "\n");
>>   }
>>   
>>   /*
>>



  reply	other threads:[~2020-07-23 14:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 11:58 [PATCH for-5.1 0/2] tpm: Fix error reporting, improve help Markus Armbruster
2020-07-23 11:58 ` [PATCH for-5.1 1/2] Revert "tpm: Clean up error reporting in tpm_init_tpmdev()" Markus Armbruster
2020-07-23 12:50   ` Philippe Mathieu-Daudé
2020-07-23 14:20     ` Stefan Berger
2020-07-23 11:58 ` [PATCH for-5.1 2/2] tpm: Improve help on TPM types when none are available Markus Armbruster
2020-07-23 12:49   ` Philippe Mathieu-Daudé
2020-07-23 14:22     ` Stefan Berger [this message]
2020-07-24  0:56   ` Stefan Berger
2020-07-24  6:42     ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e0270711-f453-fa99-dc2e-74032b24118c@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=armbru@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).