From: Zhiyong Yang Date: Thu, 3 Aug 2017 01:21:50 +0000 (+0800) Subject: net/virtio: replace magic number with PCI constant X-Git-Tag: spdx-start~1670 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0373ab9bfca60cbc62b2f5dc9a914b5ece63ba31;p=dpdk.git net/virtio: replace magic number with PCI constant To use macro instead of magic number in order to enhance code readability. Signed-off-by: Zhiyong Yang Reviewed-by: Maxime Coquelin Acked-by: Yuanhan Liu --- diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c index e6da6802b2..55b717c03e 100644 --- a/drivers/net/virtio/virtio_pci.c +++ b/drivers/net/virtio/virtio_pci.c @@ -553,7 +553,7 @@ get_cfg_addr(struct rte_pci_device *dev, struct virtio_pci_cap *cap) uint32_t offset = cap->offset; uint8_t *base; - if (bar > 5) { + if (bar >= PCI_MAX_RESOURCE) { PMD_INIT_LOG(ERR, "invalid bar: %u", bar); return NULL; }