qemu-ppc
[Top][All Lists]
Advanced

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

Re: [PATCH v2 01/15] hw/pci/pcie_sriov: Replace fprintf(error_pretty) ->


From: Markus Armbruster
Subject: Re: [PATCH v2 01/15] hw/pci/pcie_sriov: Replace fprintf(error_pretty) -> warn_reportf_err()
Date: Mon, 25 Sep 2023 12:24:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

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

> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/pci/pcie_sriov.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c
> index f0bd72e069..93b0624599 100644
> --- a/hw/pci/pcie_sriov.c
> +++ b/hw/pci/pcie_sriov.c
> @@ -196,19 +196,17 @@ static void register_vfs(PCIDevice *dev)
>  
>  static void unregister_vfs(PCIDevice *dev)
>  {
> -    Error *local_err = NULL;
>      uint16_t num_vfs = dev->exp.sriov_pf.num_vfs;
>      uint16_t i;
>  
>      trace_sriov_unregister_vfs(dev->name, PCI_SLOT(dev->devfn),
>                                 PCI_FUNC(dev->devfn), num_vfs);
>      for (i = 0; i < num_vfs; i++) {
> +        Error *errp = NULL;
>          PCIDevice *vf = dev->exp.sriov_pf.vf[i];
> -        object_property_set_bool(OBJECT(vf), "realized", false, &local_err);
> -        if (local_err) {
> -            fprintf(stderr, "Failed to unplug: %s\n",
> -                    error_get_pretty(local_err));
> -            error_free(local_err);
> +        object_property_set_bool(OBJECT(vf), "realized", false, &errp);
> +        if (errp) {
> +            warn_reportf_err(errp, "Failed to unplug: ");
>          }
>          object_unparent(OBJECT(vf));
>      }

We use @errp for Error **, and @err, @local_err and similar for Error *.
Recommend to stick with @local_err here, i.e. just

  -            fprintf(stderr, "Failed to unplug: %s\n",
  -                    error_get_pretty(local_err));
  -            error_free(local_err);
  +            warn_reportf_err(local_err, "Failed to unplug: ");




reply via email to

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