From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f169.google.com (mail-wr0-f169.google.com [209.85.128.169]) by dpdk.org (Postfix) with ESMTP id A414F567C for ; Sun, 9 Jul 2017 03:46:03 +0200 (CEST) Received: by mail-wr0-f169.google.com with SMTP id k67so93419308wrc.2 for ; Sat, 08 Jul 2017 18:46:03 -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=BaPjeDhjswnne2aRg8vcmrwBqt+0PyZvXt360WjDp7U=; b=oY/+homn8iGqjDWtfVerINd7uGUxbL1C4RCxXS8JbyrGIKgV3nB2IB55KXyzIX9btV 778hpY0n6eztc+cYhr9ODaHq8M1IeqqjlqUDeR6p2UeSmkpGic1jxQxbLDJNtvznplDF dMq9rj797iAq69kWAVfeOeQZwRhD3XTP8cMpVe47HwiAHZiDRFYK9IH+f8aRJXRYOYcp 1MgAOlmxZB5z64hhftCIsoDr01CW6/5Cnx+I5Xio8903TY5V1dVci6ZDKXatyCl9SCzc RRGqtHqGdhc22gmwQDEtxEFSUeoGrh8W8jLVH+99Sx02vA3lNCJNcORkrKvWz+IzNIkZ W4Ww== 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=BaPjeDhjswnne2aRg8vcmrwBqt+0PyZvXt360WjDp7U=; b=WGH5eyNFmw3EHWtc/+GeGlM/JstFcRxBoKAcxlD25RO3unhvepirNbVQT/dIH/xXxT zP05BXoU2IhWgRMQ7cSpYwpUgA3aQq5Jo2UCHZVLBLkSbppOsJcAIiM9UfIhvcv8X46e +VLv27ZaxNw/BWAh5yME3KdbwVla56RCAKopw6+W3R6v43fb3ay/foH5aBhOOSBpMExA yyemDXBtxibNnNtd2h8XjijbQFZSm/csqquzfpF4ZHUJbhsOoP2fwABPpo3lNq/85DKn 645IydoNy+05LLPp0MCpZzTSkBZEVyHNvBwMHPGcBzBMRpRRL4jp6bMiSOTw1U8+WCrj 3sDQ== X-Gm-Message-State: AIVw112pii5658u1FUFe6Na3C7Nfwgw71SxO/9GxocS9QJZLgW0q4yFz Y2sMy8EdKWmKf/+ekgg= X-Received: by 10.28.146.208 with SMTP id u199mr3520668wmd.6.1499564763079; Sat, 08 Jul 2017 18:46:03 -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 h130sm2430609wmd.34.2017.07.08.18.46.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 08 Jul 2017 18:46:02 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Sun, 9 Jul 2017 03:45:40 +0200 Message-Id: <566fc39521fbf82d43a2b867d41a5ad56f488784.1499563730.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 4/9] 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: Sun, 09 Jul 2017 01:46:04 -0000 Use the new rte_eal_devargs_rmv() API to free allocated resources during device removal or when encountering errors when adding devices. 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