From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 86712A0C43; Sun, 12 Sep 2021 12:37:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E316F41136; Sun, 12 Sep 2021 12:37:04 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2083.outbound.protection.outlook.com [40.107.220.83]) by mails.dpdk.org (Postfix) with ESMTP id 4A1AE41103; Sun, 12 Sep 2021 12:37:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wk1oMoHFDqOypEsojgavzNJtlL1Sv7C8+CqyVActtrJ4r9gTToIwTNTevPq+94vAHffNDgNGrTpb6ju5eMObH15GT/6EbLPxp53WfusXKgVCdmdOn7u3tNn4xFd6lcOx0prUTP657tgqHqLfpY/WOD7r1mOBewFwbFt8oUmiYH23dneVMg/OHzMqs7NlAf9lobbdLQ9U8Eo/qu+N8rtXzOICZfsmqk5wnK8fDDTm40I1hhtyOcuKZQvfGDlKwBlHMT7T04JMO30kdcltbEFysLnCA/LpKEgDwzqCjMyGaAPXUJ7oTZZZdCije6/AQXROp/L9OZQ/couipkAQXldNHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=K0wiE2T/ngmh2gS9qEuLMw+TR/r429LvHvqm3hQnuYA=; b=XBwy8jCbdjEGoNbZyTT/bqC0mcTRjLjosJm+YTZzKTUXAUOvqkC+OIZe5VrGLppzxomYcj9dHIwEtmLXYPwslt5YVNNn1cOwfyJeSnOV27QU0n6+7nbmxmd4YcK0b1EdNMNcCHTEtC72grqK0mtuJTEdmPAse8pxRHB3ZLCgaux9+Xg26DxddB3VUTfXOUS5nA4JvqcF3DZ0oJQzAemnFzeP+vksSsTMGaGntB1Sd36Losl/UHeapqL3v0LvbP36xKnodfF2f3tRibfAhQmrDAeu15SeZLXT4ilxNQsB7QSQG0STXFNnk8musjPQ80ihfcgKDodw/Mm8mN22Wvsu7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K0wiE2T/ngmh2gS9qEuLMw+TR/r429LvHvqm3hQnuYA=; b=Fth+Bul2pnRgvsTZF6I9LJolkzwi6bVo/5QVj3xZb+bk5ZbK2zD+zJOFbfMPi+wAvVlXo2Xr5FXrZygcM+wCdovroPx0cFT+SSBnFt4cVg+za1+CXHGya47LobuUi3VID5/gpiKGqnYcPZpxgItG99+B+sCeDt5ds55eRGrc6IK/VvHI5IUPh6QSr4Yb/vwCzzMVamJ5M0LC+HeblgZn3p6MMaECqT+bX1awR8NmX6sukVyKtDjzNBsE4UJBLLU/sp3x19qlLZC/q8k7sAOEQzRaCCFWGNIr1Q2NCtuyMzAVZWtFVACyFl003g2ILdSnryUrX4qfubmHlqPuyngQ4g== Received: from DM6PR03CA0031.namprd03.prod.outlook.com (2603:10b6:5:40::44) by BL0PR12MB4676.namprd12.prod.outlook.com (2603:10b6:207:19::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14; Sun, 12 Sep 2021 10:36:59 +0000 Received: from DM6NAM11FT066.eop-nam11.prod.protection.outlook.com (2603:10b6:5:40:cafe::6a) by DM6PR03CA0031.outlook.office365.com (2603:10b6:5:40::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Sun, 12 Sep 2021 10:36:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by DM6NAM11FT066.mail.protection.outlook.com (10.13.173.179) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4500.14 via Frontend Transport; Sun, 12 Sep 2021 10:36:59 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 12 Sep 2021 03:36:59 -0700 Received: from nvidia.com (172.20.187.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 12 Sep 2021 10:36:57 +0000 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko , Date: Sun, 12 Sep 2021 13:36:28 +0300 Message-ID: <20210912103628.257499-7-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210912103628.257499-1-michaelba@nvidia.com> References: <20210831203732.3411134-1-michaelba@nvidia.com> <20210912103628.257499-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 63d8effc-a10f-4bf8-d789-08d975d9403e X-MS-TrafficTypeDiagnostic: BL0PR12MB4676: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wvX630pAVDWqxI1Xh2Kwp6tVJP8L+S8G8fCx2AFY3jjeAbnOazLNuzEYuVOIo0KYrE1VGHBehIVh3Z1avfNkTn0CSa8wUyTrynW2tOXIGp9FRQmRoB34nHI8LCkIo53UAzol7rds6VSY3Vx7pipJAVSJayRIViAUXuyj648NujdKxWw1bwz1pqZ2iBxjFGC+6QwEfph1bb5gZfcciCiiphSPCO8Szb79WpL+cH/ue6O3jZ7ksLkCxP8YoqUJth0qTS0MOCtu1GQTUiy3bm267s1NaDPZdwp/EWdtxxeM+Wm2wgUlg9zYEsAonu/GZhmvkzHFhaNrgFRyKNXc+0fLGsjPcrmaFYtDtNsnlRuJL77dkPkHU9m0NDLdFdrb8Q4QoqvxxlstTWln+wDNBSDk1tEjHi4Cc1bWUBPpFWARyx511YPD43AUCjUXhGM5vEoCoe75/4pkF0PF3V4ABJnSTB0jU+D7tvIfJUtYZnXjHuS+uAd4/xktNk6Odht1CFP232B05xTU9MRuYViNf23Itcea7PFeRr1Mpjyg3W++NP43vw7VV+D0+SftvFgLWorjjdEfcYlFp/3OAf+3gZCMoeF9Exr9tEuiXo7P2F71NM1OabU+2UYVWj/rGqnwUQQHZZJRmvlCXEiRJbOc3h/r53WTl+LG+eQzTdgfCsDXBWAnZIoZiqEUfskjpratOAlC7p1H04zA4ZQel0Uj8i7bLg== X-Forefront-Antispam-Report: CIP:216.228.112.32; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid01.nvidia.com; CAT:NONE; SFS:(4636009)(136003)(376002)(396003)(346002)(39860400002)(36840700001)(46966006)(5660300002)(82310400003)(478600001)(70586007)(8936002)(7636003)(47076005)(356005)(16526019)(6666004)(186003)(2616005)(70206006)(2906002)(336012)(36860700001)(426003)(54906003)(4326008)(8676002)(6286002)(7696005)(83380400001)(86362001)(1076003)(55016002)(26005)(6916009)(36756003)(450100002)(82740400003)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2021 10:36:59.4729 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 63d8effc-a10f-4bf8-d789-08d975d9403e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.32]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT066.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4676 Subject: [dpdk-dev] [PATCH v2 6/6] common/mlx5: fix resource cleanliness in a device remove X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The common remove function call in a loop to remove function for each driver which have been registered. If all removes are succeeded, it return 0 without to free the device which allocated in probe function. Otherwise, it free the device. In fact we expect exactly the opposite behavior. If all removes are failed, it return error without to free the device which allocated in probe function. Otherwise, it free the device and return 0. Replace it with the correct behavior. Fixes: 8a41f4deccc3 ("common/mlx5: introduce layer for multiple class drivers") Cc: stable@dpdk.org Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/common/mlx5/mlx5_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index 4321cb3a9c..6885bbb1d2 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -354,7 +354,7 @@ mlx5_common_dev_remove(struct rte_device *eal_dev) return -ENODEV; /* Matching device found, cleanup and unload drivers. */ ret = drivers_remove(dev, dev->classes_loaded); - if (ret != 0) + if (ret == 0) dev_release(dev); return ret; } -- 2.25.1