From: "Michael S. Tsirkin" <mst@redhat.com>
To: Julia Suvorova <jusual@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH] hw/pci/pci: Fix slot check for plugged devices
Date: Wed, 23 Sep 2020 11:02:14 -0400 [thread overview]
Message-ID: <20200923110141-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20200923092636.118676-1-jusual@redhat.com>
On Wed, Sep 23, 2020 at 11:26:36AM +0200, Julia Suvorova wrote:
> If devfn is assigned automatically, 'else' clauses will never be
> executed. And if it does not matter for the reserved and available
> devfn, because we have already checked it, the check for function0
> needs to be done again.
>
> Signed-off-by: Julia Suvorova <jusual@redhat.com>
This is just cosmetics right? I wouldn't describe this as
a "fix" then - "simplify" would be clearer.
> ---
> hw/pci/pci.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index de0fae10ab..ae132b0b52 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -1034,8 +1034,9 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev,
> PCI_SLOT(devfn), PCI_FUNC(devfn), name,
> bus->devices[devfn]->name);
> return NULL;
> - } else if (dev->hotplugged &&
> - pci_get_function_0(pci_dev)) {
> + };
> +
> + if (dev->hotplugged && pci_get_function_0(pci_dev)) {
> error_setg(errp, "PCI: slot %d function 0 already ocuppied by %s,"
> " new func %s cannot be exposed to guest.",
> PCI_SLOT(pci_get_function_0(pci_dev)->devfn),
> --
> 2.25.4
next prev parent reply other threads:[~2020-09-23 15:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-23 9:26 [PATCH] hw/pci/pci: Fix slot check for plugged devices Julia Suvorova
2020-09-23 15:02 ` Michael S. Tsirkin [this message]
2020-09-23 15:57 ` Julia Suvorova
2020-09-24 7:56 ` Michael S. Tsirkin
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=20200923110141-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=imammedo@redhat.com \
--cc=jusual@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).