[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 04/15] hw/pci/pcie_sriov: Do not open-code qdev_unrealize_
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v2 04/15] hw/pci/pcie_sriov: Do not open-code qdev_unrealize_and_unref() |
Date: |
Mon, 25 Sep 2023 12:31:43 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> (See commits dc3edf8d8a "Convert to qdev_unrealize() manually"
> and 981c3dcd94 "Convert to qdev_unrealize() with Coccinelle").
>
> Reported-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/pci/pcie_sriov.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c
> index 93b0624599..0b6101302b 100644
> --- a/hw/pci/pcie_sriov.c
> +++ b/hw/pci/pcie_sriov.c
> @@ -204,11 +204,10 @@ static void unregister_vfs(PCIDevice *dev)
> 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, &errp);
> - if (errp) {
> +
> + if (!qdev_unrealize_and_unref(DEVICE(vf), &errp)) {
> warn_reportf_err(errp, "Failed to unplug: ");
> }
> - object_unparent(OBJECT(vf));
> }
> g_free(dev->exp.sriov_pf.vf);
> dev->exp.sriov_pf.vf = NULL;
This replaces object_unref() by object_unparent(). Why is that okay?
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH v2 04/15] hw/pci/pcie_sriov: Do not open-code qdev_unrealize_and_unref(),
Markus Armbruster <=