From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shreyansh Jain Subject: Re: [PATCH v2 1/7] pci: If a driver's probe function fails, unmap resources. Date: Fri, 25 Nov 2016 14:51:35 +0530 Message-ID: References: <1479929804-19614-1-git-send-email-benjamin.walker@intel.com> <1479931644-78960-1-git-send-email-benjamin.walker@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Cc: To: Ben Walker Return-path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0058.outbound.protection.outlook.com [104.47.40.58]) by dpdk.org (Postfix) with ESMTP id E3C3FF72 for ; Fri, 25 Nov 2016 10:18:46 +0100 (CET) In-Reply-To: <1479931644-78960-1-git-send-email-benjamin.walker@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thursday 24 November 2016 01:37 AM, Ben Walker wrote: > If resources were mapped prior to probe, unmap them > if probe fails. > > This does not handle the case where the kernel driver was > forcibly unbound prior to probe. > > Signed-off-by: Ben Walker > --- > lib/librte_eal/common/eal_common_pci.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c > index 6bff675..4f8c3a0 100644 > --- a/lib/librte_eal/common/eal_common_pci.c > +++ b/lib/librte_eal/common/eal_common_pci.c > @@ -215,8 +215,11 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d > > /* call the driver probe() function */ > ret = dr->probe(dr, dev); > - if (ret) > + if (ret) { > dev->driver = NULL; > + if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) > + rte_eal_pci_unmap_device(dev); > + } > > return ret; > } > Acked-by: Shreyansh Jain