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 B1C9AA0C58; Tue, 31 Aug 2021 22:38:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 92C664115F; Tue, 31 Aug 2021 22:38:17 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2083.outbound.protection.outlook.com [40.107.236.83]) by mails.dpdk.org (Postfix) with ESMTP id C6482410FD; Tue, 31 Aug 2021 22:38:15 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N5T991ppt0RFYp5Wx8aG1HHhDn9b+IJn8TzF2zTImBpZnFi7yh0GxzuzHzlUYmzkZrc3YwWi0q00gtj6sZEz5Tun5V5x+7uR/ctb/NQHE/8IE/kkUBRS4ecZklXbn9suU5y5Kk4NkpZ/VRmgtwd7uziJbS21zgQ8OK+btniMqLXjAcfSxMMdHIFOPIO57AuGQrsPhkFm6EYG1VsjUEooZhED8lIl7xWmw6oSn5/oYXQK7WTbArp/gfjmj9hEWLxtI+TsWOkOARc6s8Fm2rPXHMi4sMNicQmADRoGO+adMvgyDGDmfnRASgVHayoMOY5aCDvBYrudwUwTqjrDgjz6Fw== 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:X-MS-Exchange-SenderADCheck; bh=D7NUAELA2lTjvAWtcl5L9DhD7PIMyztd/grekSzaOLI=; b=JnXGQb1aIyA56Ug/xxBnGVnVDUcBILhmnaePAvQNVEwsrQ4mgPYaPqjdFnQiUuIQLHzhAI7cHTxzFU+y+y5pCE1ElRbXTXgcxBSrLSIN07Uo8nCBGa4smhpatnj4EHiCZzsBRhus0uO166f/P+hNMewkt+6VEff5SQaOVD3p7aS4r/jNJcb0szQyrmpSfWrYkA2kls+/JefiZ/eQSTe8pqIeimiNVkHyYW/2d+YREl911oy+5nWORCfbZxVJBp2tziXoYJGnhV8gfP5zyhoO/jHlxEyLvXTDIqzngE3/iXxkyvT7h2NPage1Sn6Hk+B+axpnJ1yu62+IdMVkY3mJMQ== 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=D7NUAELA2lTjvAWtcl5L9DhD7PIMyztd/grekSzaOLI=; b=VaY0bxXF1D3FggVyAwRVZrhGfrJuuPDvbukq+/FGSUE3IFiBkOMsW95RtiP+jfrg0oaQAp6a+HAcAV/fwWIHdA6+OEh0SJ70gl7+DecMjmM043GHdtROcyyr4Pujz30EdexpHnJoTE2c1aLq+/T8PjhUAdcplRx6vrcRZjUB3xESfyWf5REawYblHs1LBR5Q1hq8lPQZAttHRV1QDYT7+n3Rk0uwNptIuzlv35QuNwJ+BgGpFX+eCGDcwxu9Gz9FhrA8iyiBAOzEZRJmJ8tRhRTknox8SWhN9wIm5VJ5/TYO+TshbXjEWqr96SrJq18i8Vspln9p1DC8aBSJBfI2GA== Received: from MWHPR13CA0014.namprd13.prod.outlook.com (2603:10b6:300:16::24) by MWHPR12MB1744.namprd12.prod.outlook.com (2603:10b6:300:111::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.23; Tue, 31 Aug 2021 20:38:14 +0000 Received: from CO1NAM11FT031.eop-nam11.prod.protection.outlook.com (2603:10b6:300:16:cafe::36) by MWHPR13CA0014.outlook.office365.com (2603:10b6:300:16::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.6 via Frontend Transport; Tue, 31 Aug 2021 20:38:14 +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 CO1NAM11FT031.mail.protection.outlook.com (10.13.174.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4457.17 via Frontend Transport; Tue, 31 Aug 2021 20:38:14 +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.2; Tue, 31 Aug 2021 13:38:13 -0700 Received: from nvidia.com (172.20.187.6) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 31 Aug 2021 20:38:05 +0000 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko , Date: Tue, 31 Aug 2021 23:37:32 +0300 Message-ID: <20210831203732.3411134-7-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210831203732.3411134-1-michaelba@nvidia.com> References: <20210831203732.3411134-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 67254cf2-5cf9-49e7-aa23-08d96cbf4191 X-MS-TrafficTypeDiagnostic: MWHPR12MB1744: 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: M4gWSEiBDba9lMgnIAuF5MaXVg3M/6e+RMti1elmSSPB3lo81EqLTk//09K17zRJDcgTiiIyeAVHl4wUqM8SXOMYQR1qlBZV33TN1MIMl0xfDkwbrHfKaAu0RifyfvAtEvy5wGX4Kp9Yl9h9rlX6hfEu9fXi13rorDFA9tZ/h4peREPsT3jESWRwiOv3YtG/Aj0xFg24Al29y8/gRTlCqc6ADuO/iVCrBe7nHkN/BlBFi+PLzS5mXjtCC4Ke0xMtzLaMdihsuVLvBpnaJVDSTxZFTZ3fmo7zoQOUoqNyLlNDmGbHyMuuTWMd8mgUp7fMNvVCl5ZMULup45WO5ksQ+g28d8rjcd/YS76hEdC72G9Azcrqzo1efIZjmtxzcdUXPuAsANnJwLTyjN7j1z+TcMpgewFEK/mQrOD07P9leUStprJAd1bkod3BdhxXSe5aBLg/yewciePth2ogyDytw9umOm3AUcUQzrHuaWOXlCmhcIUDNf6xikih5rxGpZAMgW5au4sCmZrjIB8FkvHTfB4qpMnPal8qqjfdL1xoYcYbJYvw3ZYFxCNJPxjTSfnbioIgo7H2LUVihLcYPoT5Nw4iUjKcHEuXHghxjpy7JgC+0hTrBDozuoj19r9M6+Bi6Zr5WPltID0QL8HkYV6MJ7+j0shZh3W/5MaqA9gKRE7D8sODmcmkFvFmk/FI8hPVIVyR+Q/is2RHu0VsAFXmRw== 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)(346002)(376002)(136003)(396003)(39860400002)(36840700001)(46966006)(36860700001)(6286002)(47076005)(5660300002)(82310400003)(336012)(2906002)(8936002)(83380400001)(7636003)(450100002)(356005)(82740400003)(70206006)(186003)(316002)(55016002)(8676002)(36756003)(54906003)(70586007)(1076003)(426003)(26005)(478600001)(7696005)(86362001)(6916009)(4326008)(6666004)(16526019)(2616005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2021 20:38:14.3145 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 67254cf2-5cf9-49e7-aa23-08d96cbf4191 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: CO1NAM11FT031.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1744 Subject: [dpdk-dev] [PATCH 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 --- 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