From: Yuanhan Liu <yliu@fridaylinux.org>
To: Brian Russell <brussell@brocade.com>
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] virtio: fix PCI config err handling
Date: Mon, 12 Jun 2017 18:31:45 +0800 [thread overview]
Message-ID: <20170612103145.GB2611@yliu-home> (raw)
In-Reply-To: <1496677473-17893-1-git-send-email-brussell@brocade.com>
On Mon, Jun 05, 2017 at 04:44:33PM +0100, Brian Russell wrote:
> In virtio_read_caps, rte_pci_read_config returns the number of bytes
> read from PCI config or <0 on error.
> If less than the expected number of bytes are read then log the
> failure and return rather than carrying on with garbage.
>
> Signed-off-by: Brian Russell <brussell@brocade.com>
> ---
> drivers/net/virtio/virtio_pci.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
> index b7b3d61..90c098e 100644
> --- a/drivers/net/virtio/virtio_pci.c
> +++ b/drivers/net/virtio/virtio_pci.c
> @@ -592,16 +592,18 @@ virtio_read_caps(struct rte_pci_device *dev, struct virtio_hw *hw)
> }
>
> ret = rte_pci_read_config(dev, &pos, 1, PCI_CAPABILITY_LIST);
> - if (ret < 0) {
> - PMD_INIT_LOG(DEBUG, "failed to read pci capability list");
> + if (ret != 1) {
> + PMD_INIT_LOG(DEBUG,
> + "failed to read pci capability list, ret %d", ret);
> return -1;
> }
There are two things worth mentioning:
- rte_pci.h states nothing about the return value
- The BSD implementation actually returns 0 on success, while the Linux
implementation indeed returns the bytes read.
--yliu
prev parent reply other threads:[~2017-06-12 10:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-05 15:44 Brian Russell
2017-06-12 10:31 ` Yuanhan Liu [this message]
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=20170612103145.GB2611@yliu-home \
--to=yliu@fridaylinux.org \
--cc=brussell@brocade.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
/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).