From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f174.google.com (mail-wr0-f174.google.com [209.85.128.174]) by dpdk.org (Postfix) with ESMTP id 30EC637B4 for ; Fri, 7 Jul 2017 02:10:00 +0200 (CEST) Received: by mail-wr0-f174.google.com with SMTP id 77so24323219wrb.1 for ; Thu, 06 Jul 2017 17:10:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=dgZq/HFLDXOIvUWL4bzor1lpDqV7sZlChbP8dbrxgbA=; b=yVHrg51o+esNxeZudkadu6W+wflRRXcDVhcyQ1mofwZtL5f8tmfxcQ8EBoyh5GS0GZ icqWaRkpjXWt5+0NMg2jDb7hT6oZCAjeHTrdSdeKKp58x4tJGwL320T8tFjGyATaJiX8 dEeqFIExWxc0Gi7LL7Mm8pv9NOGGLaW/ObA7wkOMDNnXk+USmAy68Arybu+JuorbVV9k W4EG9zFD+cyAU93tkReI8D75e4D47Fy/W7QqS8KWaZLIqhq0WpVXQp8Rn8U5cFdRAL7K rTZmCUt60mrROihpg85BIfgfkjhQu3Za5ps7VmH6sTxjj9XBnk9hySIlfu9DLqGK/syo nlUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=dgZq/HFLDXOIvUWL4bzor1lpDqV7sZlChbP8dbrxgbA=; b=KJk6fwuDdGM3Xu648nhdI8VTw8EmGpy+MLvw3c823jdqyP6MquBZfelNMcvZYpyuZu bIsg1AWtaM1U3j3nLDfqnDluXlrqMr8paQTvIGM46LRrE6ApjnqRqpaORmdXMB2nDrnG clCiK9pkDhK45ZDxef0LVzOyXUGQAQB6lZ2ya0FMmVK4QTzvGNa/mzQbB4Vt+/VfjIrh 1AouNui89/2PsVjoj/JU4lJ1U+Axe9fxpwkivSktFvIHLtuoxOe3AaY4nUx8E50XwnHh NSAKW3cyt4jB44qV08rRzhhgQ2lf7cThKAbDNqgZUlqwRHxRIztcfrq3ffPyz50C2A/l uVRw== X-Gm-Message-State: AIVw110LnUuS15xUY4A+gsledRrQ0i4pRK4L5iIbx+/DKFVCXwX2vuWA GI8Mldpd63Uu3AskSsM= X-Received: by 10.28.173.65 with SMTP id w62mr255810wme.113.1499386199647; Thu, 06 Jul 2017 17:09:59 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id f45sm2391166wrf.2.2017.07.06.17.09.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Jul 2017 17:09:58 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Fri, 7 Jul 2017 02:09:11 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v6 04/22] eal: release devargs on device removal 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: Fri, 07 Jul 2017 00:10:00 -0000 Release resources allocated for devargs when the device is being removed. Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_dev.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c index 708c8e9..143c231 100644 --- a/lib/librte_eal/common/eal_common_dev.c +++ b/lib/librte_eal/common/eal_common_dev.c @@ -177,7 +177,7 @@ rte_eal_hotplug_add(const char *busname, const char *devname, ret = bus->scan(); if (ret) { rte_errno = -ret; - goto err_name; + goto err_devarg; } dev = bus->find_device(NULL, cmp_detached_dev_name, devname); @@ -185,7 +185,7 @@ rte_eal_hotplug_add(const char *busname, const char *devname, RTE_LOG(ERR, EAL, "Cannot find unplugged device (%s)\n", devname); rte_errno = EINVAL; - goto err_name; + goto err_devarg; } ret = bus->plug(dev, devargs); @@ -193,11 +193,13 @@ rte_eal_hotplug_add(const char *busname, const char *devname, RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n", dev->name); rte_errno = -ret; - goto err_name; + goto err_devarg; } free(name); return dev; +err_devarg: + rte_eal_devargs_rmv(busname, devname); err_name: free(name); return NULL; @@ -230,6 +232,8 @@ int rte_eal_hotplug_remove(const char *busname, const char *devname) return -EINVAL; } + rte_eal_devargs_rmv(busname, devname); + dev->devargs = NULL; ret = bus->unplug(dev); if (ret) { RTE_LOG(ERR, EAL, "Driver cannot detach the device (%s)\n", -- 2.1.4