From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 59DB89A9C for ; Fri, 13 Mar 2015 15:49:06 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 13 Mar 2015 07:47:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,395,1422950400"; d="scan'208";a="466852900" Received: from irsmsx152.ger.corp.intel.com ([163.33.192.66]) by FMSMGA003.fm.intel.com with ESMTP; 13 Mar 2015 07:42:08 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.218]) by IRSMSX152.ger.corp.intel.com ([169.254.6.205]) with mapi id 14.03.0195.001; Fri, 13 Mar 2015 14:49:03 +0000 From: "Iremonger, Bernard" To: Tetsuya Mukawa , "dev@dpdk.org" Thread-Topic: [PATCH v2 04/15] eal: Fix needless incrementation of pci_map_addr Thread-Index: AQHQXK3mzax4mzP+RUiu7V/LzvDRzZ0af/Ng Date: Fri, 13 Mar 2015 14:49:03 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C2049F29B4@IRSMSX108.ger.corp.intel.com> References: <1425438703-18895-1-git-send-email-mukawa@igel.co.jp> <1426155474-1596-1-git-send-email-mukawa@igel.co.jp> <1426155474-1596-5-git-send-email-mukawa@igel.co.jp> In-Reply-To: <1426155474-1596-5-git-send-email-mukawa@igel.co.jp> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 04/15] eal: Fix needless incrementation of pci_map_addr X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Mar 2015 14:49:06 -0000 > -----Original Message----- > From: Tetsuya Mukawa [mailto:mukawa@igel.co.jp] > Sent: Thursday, March 12, 2015 10:18 AM > To: dev@dpdk.org > Cc: Iremonger, Bernard; Richardson, Bruce; Tetsuya Mukawa > Subject: [PATCH v2 04/15] eal: Fix needless incrementation of pci_map_add= r >=20 > When pci_map_resource() is failed, mapaddr will be MAP_FAILED. > In this case, pci_map_addr should not be incremented. > The patch fixes it. Also, fix below. > - To shrink code, move close(). > - Remove fail variable. >=20 > Signed-off-by: Tetsuya Mukawa > --- > lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) >=20 > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/l= inuxapp/eal/eal_pci_uio.c > index 901f277..2741c62 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > @@ -337,7 +337,6 @@ pci_uio_map_resource(struct rte_pci_device *dev) > maps =3D uio_res->maps; > for (i =3D 0, map_idx =3D 0; i !=3D PCI_MAX_RESOURCE; i++) { > int fd; > - int fail =3D 0; >=20 > /* skip empty BAR */ > phaddr =3D dev->mem_resource[i].phys_addr; @@ -371,18 +370,13 @@ > pci_uio_map_resource(struct rte_pci_device *dev) >=20 > mapaddr =3D pci_map_resource(pci_map_addr, fd, 0, > (size_t)dev->mem_resource[i].len, 0); > + close(fd); > if (mapaddr =3D=3D MAP_FAILED) > - fail =3D 1; > + goto fail1; >=20 > pci_map_addr =3D RTE_PTR_ADD(mapaddr, > (size_t)dev->mem_resource[i].len); >=20 > - if (fail) { > - close(fd); > - goto fail1; > - } > - close(fd); > - > maps[map_idx].phaddr =3D dev->mem_resource[i].phys_addr; > maps[map_idx].size =3D dev->mem_resource[i].len; > maps[map_idx].addr =3D mapaddr; > -- > 1.9.1 Hi Tetsuya, This patch could be squashed into patch 3. Regards, Bernard.