From: Markus Armbruster <armbru@redhat.com>
To: Klaus Jensen <its@irrelevant.dk>
Cc: qemu-devel@nongnu.org, Keith Busch <kbusch@kernel.org>,
qemu-block@nongnu.org, Klaus Jensen <k.jensen@samsung.com>
Subject: Re: [PATCH v2 1/2] hw/nvme: fix incorrect use of errp/local_err
Date: Thu, 10 Nov 2022 11:03:31 +0100 [thread overview]
Message-ID: <87a64zjfd8.fsf@pond.sub.org> (raw)
In-Reply-To: <20221110062335.18401-2-its@irrelevant.dk> (Klaus Jensen's message of "Thu, 10 Nov 2022 07:23:34 +0100")
Klaus Jensen <its@irrelevant.dk> writes:
> From: Klaus Jensen <k.jensen@samsung.com>
>
> Make nvme_check_constraints() return a bool and fix an invalid error
> propagation where the actual error is thrown away in favor of an unused
> local Error value.
Is it? I think you're talking about ...
> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
> ---
> hw/nvme/ctrl.c | 48 +++++++++++++++++++++++-------------------------
> 1 file changed, 23 insertions(+), 25 deletions(-)
>
> diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
> index ac3885ce5079..a5c0a5fa6ce2 100644
> --- a/hw/nvme/ctrl.c
> +++ b/hw/nvme/ctrl.c
[...]
> @@ -7564,7 +7566,6 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
> {
> NvmeCtrl *n = NVME(pci_dev);
> NvmeNamespace *ns;
> - Error *local_err = NULL;
> NvmeCtrl *pn = NVME(pcie_sriov_get_pf(pci_dev));
>
> if (pci_is_vf(pci_dev)) {
> @@ -7576,9 +7577,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
> n->subsys = pn->subsys;
> }
>
> - nvme_check_constraints(n, &local_err);
> - if (local_err) {
> - error_propagate(errp, local_err);
> + if (!nvme_check_params(n, errp)) {
> return;
> }
>
> @@ -7586,7 +7585,6 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
> &pci_dev->qdev, n->parent_obj.qdev.id);
>
> if (nvme_init_subsys(n, errp)) {
> - error_propagate(errp, local_err);
... this one. error_propagate() does nothing here, because @local_err
is still null.
> return;
> }
> nvme_init_state(n);
next prev parent reply other threads:[~2022-11-10 10:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-10 6:23 [PATCH v2 0/2] hw/nvme: errp fixes Klaus Jensen
2022-11-10 6:23 ` [PATCH v2 1/2] hw/nvme: fix incorrect use of errp/local_err Klaus Jensen
2022-11-10 9:59 ` Philippe Mathieu-Daudé
2022-11-10 22:02 ` Klaus Jensen
2022-11-10 10:03 ` Markus Armbruster [this message]
2022-11-10 6:23 ` [PATCH v2 2/2] hw/nvme: cleanup error reporting in nvme_init_pci() Klaus Jensen
2022-11-10 10:00 ` Markus Armbruster
2022-11-10 22:06 ` Klaus Jensen
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=87a64zjfd8.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=its@irrelevant.dk \
--cc=k.jensen@samsung.com \
--cc=kbusch@kernel.org \
--cc=qemu-block@nongnu.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.