[dpdk-dev] [PATCH 3/4] virtio: return 1 to tell the upper layer we don't take over this device
Yuanhan Liu
yuanhan.liu at linux.intel.com
Mon Dec 28 06:25:13 CET 2015
On Fri, Dec 25, 2015 at 02:38:11AM +0800, Huawei Xie wrote:
> if virtio_resource_init fails, cleanup the resource and return 1 to
> tell the upper layer we don't take over this device.
> return -1 means error and DPDK will exit.
>
> Signed-off-by: Huawei Xie <huawei.xie at intel.com>
> ---
> drivers/net/virtio/virtio_ethdev.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index d928339..00015ef 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1287,8 +1287,12 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
>
> pci_dev = eth_dev->pci_dev;
>
> - if (virtio_resource_init(pci_dev) < 0)
> - return -1;
> + /* Return 1 to tell the upper layer we don't take over this device. */
> + if (virtio_resource_init(pci_dev) < 0) {
> + rte_free(eth_dev->data->mac_addrs);
> + eth_dev->data->mac_addrs = NULL;
This assignment looks unnecessary to me.
And, I think above comment is better to put here, right above the return
statement.
> + return 1;
> + }
--yliu
More information about the dev
mailing list