Hello Tetsuya, Little comment below for this patch.
On Mon, Jul 6, 2015 at 8:24 AM, Tetsuya Mukawa <mukawa at igel.co.jp> wrote: > > diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c > b/lib/librte_eal/bsdapp/eal/eal_pci.c > index a63d450..63758c7 100644 > --- a/lib/librte_eal/bsdapp/eal/eal_pci.c > +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c > @@ -202,7 +202,7 @@ pci_uio_map_resource(struct rte_pci_device *dev) > uint64_t offset; > uint64_t pagesz; > struct rte_pci_addr *loc = &dev->addr; > - struct uio_resource *uio_res; > + struct uio_resource *uio_res = NULL; > struct uio_res_list *uio_res_list = > RTE_TAILQ_CAST(rte_uio_tailq.head, uio_res_list); > struct uio_map *maps; > [snip] > @@ -275,6 +274,16 @@ pci_uio_map_resource(struct rte_pci_device *dev) > TAILQ_INSERT_TAIL(uio_res_list, uio_res, next); > > return 0; > + > +error: > + if (uio_res) > + rte_free(uio_res); > As long as uio_res is initialized to NULL, no need to check. rte_free() behaves the same as free(). diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > index 37dc936..4e50533 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > [snip] > @@ -400,6 +397,25 @@ pci_uio_map_resource(struct rte_pci_device *dev) > TAILQ_INSERT_TAIL(uio_res_list, uio_res, next); > > return 0; > + > +error: > + for (i = 0; i < map_idx; i++) { > + pci_unmap_resource(uio_res->maps[i].addr, > + (size_t)uio_res->maps[i].size); > + rte_free(maps[i].path); > + } > + if (uio_res) > + rte_free(uio_res); > Idem. With this, Acked-by: David Marchand <david.marchand at 6wind.com> -- David Marchand