qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] [PATCH] spapr_pci: Improve error message


From: David Gibson
Subject: Re: [Qemu-ppc] [PATCH] spapr_pci: Improve error message
Date: Thu, 30 May 2019 10:40:49 +1000
User-agent: Mutt/1.11.4 (2019-03-13)

On Wed, May 29, 2019 at 07:15:09PM +0200, Greg Kurz wrote:
> Every PHB must have a unique index. This is checked at realize but when
> a duplicate index is detected, an error message mentioning BUIDs is
> printed. This doesn't help much, especially since BUID is an internal
> concept that is no longer exposed to the user.
> 
> Fix the message to mention the index property instead of BUID. As a bonus
> print a list of indexes already in use.
> 
> Signed-off-by: Greg Kurz <address@hidden>
> ---
>  hw/ppc/spapr_pci.c |    9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index 97961b012859..fb8c54f4d90f 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -1699,7 +1699,14 @@ static void spapr_phb_realize(DeviceState *dev, Error 
> **errp)
>      }
>  
>      if (spapr_pci_find_phb(spapr, sphb->buid)) {
> -        error_setg(errp, "PCI host bridges must have unique BUIDs");
> +        SpaprPhbState *s;
> +
> +        error_setg(errp, "PCI host bridges must have unique indexes");
> +        error_append_hint(errp, "The following indexes are already in use:");
> +        QLIST_FOREACH(s, &spapr->phbs, list) {
> +            error_append_hint(errp, " %d", s->index);
> +        }
> +        error_append_hint(errp, "\nTry another value for the index 
> property\n");

I like the idea, but I think newlines in error messages are frowned
upon.  You certainly don't need the trailing one.

>          return;
>      }
>  
> 

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]