From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 97B9B2C18 for ; Thu, 3 Aug 2017 03:21:59 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP; 02 Aug 2017 18:21:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,314,1498546800"; d="scan'208";a="134744230" Received: from unknown (HELO dpdk5.bj.intel.com) ([172.16.182.182]) by fmsmga005.fm.intel.com with ESMTP; 02 Aug 2017 18:21:58 -0700 From: Zhiyong Yang To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, yliu@fridaylinux.org, Zhiyong Yang Date: Thu, 3 Aug 2017 09:21:50 +0800 Message-Id: <20170803012150.59703-3-zhiyong.yang@intel.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170803012150.59703-1-zhiyong.yang@intel.com> References: <20170803012150.59703-1-zhiyong.yang@intel.com> Subject: [dpdk-dev] [PATCH 2/2] virtio: use macro to replace magic number X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 01:22:00 -0000 To use macro instead of magic number in order to enhance code readability. Signed-off-by: Zhiyong Yang --- drivers/net/virtio/virtio_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c index e6da6802b..55b717c03 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; } -- 2.13.3