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 6579BA00C3; Mon, 17 Jan 2022 18:49:40 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DA63941C2E; Mon, 17 Jan 2022 18:49:39 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2069.outbound.protection.outlook.com [40.107.92.69]) by mails.dpdk.org (Postfix) with ESMTP id 492C140143; Mon, 17 Jan 2022 18:49:38 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DEl43kngGdYf/QQ2W3njjQCh6L/lV3T4wnNG9p/6N59emhMKCIib2AgplzPEcIg3R4fgi2ApBClatu8MEM0TBiAkBNzxu2a3hyvLxRKVsYwsQqRNMrgm2NilR1PKlqEEBbpVlBwuXmur48Z4t/D4KdHlb7Srpy1OYMhGaEOiDcErnVEDEYnONfuxiJ2ofzC3+A5kN2oT/yeihQZDI+rG8zglRddUam+HDgLRBo2vFhywMBR+nDzE6wVdk/1Yf+FhZnAAmv+e4CdzcXKpvogZLgVypaAKSxNPdhrG8YKsppEM3aj0xeJOlKcp1WVfkXSZALpgisB3SCLUfrEI3ArUjA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hEYAY1wWvf1hP5i7OBPAUPDfeFF6V0n67GJo0qNRBMw=; b=NYvxDgCAPium6eamuSGXAYsuDB8W+KF2QXtlyMAkc2mnJilsPs6C8vKT8FVN4xdVuqcpfSPLyosV/WX/7aijFdUVQsPNn+rDWqNvQjh8W1+IFwV7jjEapdvTmPUtFyH2D4hzzUJIrPpvg/R3s5ehvTk7dVHLR4/8NFLP3ToxqQ79iyCAbZDwf/XBcnV6ZFZAMCbrAzQdsDjDeD7AJ4by8Olk1dguUqOqG1MqumRlFkAppZx08sTxp1I7fttoAIdUNRCDFkk7gWKBO7u4PgDfrnV5/3j8IDSLu+zfUjgoMDRtsB5I4ybQ68ef++hCgz0Kcz8Rd2N98C66FWtniEGtrQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject 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=hEYAY1wWvf1hP5i7OBPAUPDfeFF6V0n67GJo0qNRBMw=; b=ZHoy5Ij37erEmMT2HLkMPUi9kg7uW2lJEW4q1Lnbliz2DUKfgfalTRHnhByT4cfdbCfkxXYPW9N9elZ2wFi/M+K8WixHNCC1UqOn9TO02xO8Ots/L2uubIjylT2Mefc2pda0v0TSdsygw2ZqERKR5IDdPK+tMi+lN7wq4X1PALl3lDf9e+sz8l1ke/pY5EoPxhtVBJCOibix+8iWWFzLAr0PoxFG5t5o1d8HhTRTcwf6Q7a3XmcT/Sc+q78oKRmd3TAZCQMQRN8KHjiboVEJlQEqiXbfHo9k5C5EgQAx2KJoVyxJ6siCbbjA6TV8pG3BE2oUngW03+YYNFvhUz7D+g== Received: from MWHPR1401CA0012.namprd14.prod.outlook.com (2603:10b6:301:4b::22) by DM6PR12MB2987.namprd12.prod.outlook.com (2603:10b6:5:3b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Mon, 17 Jan 2022 17:49:35 +0000 Received: from CO1NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:301:4b:cafe::2b) by MWHPR1401CA0012.outlook.office365.com (2603:10b6:301:4b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.9 via Frontend Transport; Mon, 17 Jan 2022 17:49:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by CO1NAM11FT034.mail.protection.outlook.com (10.13.174.248) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4888.9 via Frontend Transport; Mon, 17 Jan 2022 17:49:35 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 17 Jan 2022 17:49:34 +0000 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.986.9; Mon, 17 Jan 2022 09:49:32 -0800 From: Bing Zhao To: , CC: , , , Subject: [PATCH] common/mlx5: fix probing return value when failing Date: Mon, 17 Jan 2022 19:49:14 +0200 Message-ID: <20220117174914.82613-1-bingz@nvidia.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d9c0ecf6-5461-4c0b-d831-08d9d9e1b99e X-MS-TrafficTypeDiagnostic: DM6PR12MB2987:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jdAQSV37VVZ2/f7RBW5qHawtsJZXmUSNN5SFzyEvAoy63VD7yQETleibmDzljsixZbbWEQfct4BN9v6MS9S8YhN/4QI1otanymaaxUKEbZZkEmMlH+oAGclnq8LXYufCl5XITyvchlHUfFGbnwaEIEJJ8M/lRaDKAwCmwB+3VCUKBCnGoWfElcWqBWZ5IHdd7mFQtD2cHuTr1V2rJqd6Efx8TtmLH+1yGoJYXp3z6i5Of9Be9iQY45w4WRwaq4Z41ygsPBp/24LGivB+ZzriI4mHgOaagy8WjROG6d5gTs2SkCmnEkhCSo2FXJXNGmZdzLfs47KqN/Uv7hxFEHfLsjTWyIMP8LuIGEEApWIpJwsIGo4/UJWbVnpFEEh1/yLpGQ9HmLOKazeqwqAP42Hjgt2LI009gdQJqx1GrCBIjRseEhJawxuvMP+TQUKDoUqZ3i7hm3iCVMU1QmUa5BTAv71FR2KQ1frluBfkwL118BUJjfLe/TggF+LNNyG4Z2i991V+pd4sepm0rX0cvZAu7B12CeqFQb64nSsN2UyS6rLkOGI9cgZb96Kv1EGx49J9DaPa1VgUU6XV8a41zEJF/zYl96MkaPKKuS/LIiX/1t8iw941Ia+P58gtb4C+gyUz6OWVROitrfZnk6GtiCVxjDG9u/LqvlpurCku0HhMLwoe7B7ErVh8FpPn8bnaxpsDI1u5WGE5EhaNRJ1YvLkehehpdXKZz3/yHqoofd6wn3itLqA/JC7orhvQde8q2mO58IULNNnOH4+Dj2xng0fB7Gh5oToRjK91Z9I60bSDxMU= X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700002)(2616005)(6666004)(16526019)(508600001)(7696005)(83380400001)(336012)(82310400004)(1076003)(426003)(40460700001)(36860700001)(6286002)(70586007)(70206006)(36756003)(4326008)(316002)(54906003)(47076005)(86362001)(110136005)(450100002)(8936002)(356005)(5660300002)(55016003)(6636002)(186003)(2906002)(26005)(81166007)(8676002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2022 17:49:35.3606 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d9c0ecf6-5461-4c0b-d831-08d9d9e1b99e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2987 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 While probing the device with unsupported class, the process should fail because no appropriate driver was found. After traversing all the drivers, an error value should be returned for the case. In the previous implementation, zero value indicating probing success was wrongly returned. Fixes: ad435d320473 ("common/mlx5: add bus-agnostic layer") Cc: xuemingl@nvidia.com Cc: stable@dpdk.org Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/common/mlx5/mlx5_common.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index 185db4d004..47a541f5ef 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -644,7 +644,7 @@ drivers_probe(struct mlx5_common_device *cdev, uint32_t user_classes) struct mlx5_class_driver *driver; uint32_t enabled_classes = 0; bool already_loaded; - int ret; + int ret = -EINVAL; TAILQ_FOREACH(driver, &drivers_list, next) { if ((driver->drv_class & user_classes) == 0) @@ -666,8 +666,10 @@ drivers_probe(struct mlx5_common_device *cdev, uint32_t user_classes) } enabled_classes |= driver->drv_class; } - cdev->classes_loaded |= enabled_classes; - return 0; + if (!ret) { + cdev->classes_loaded |= enabled_classes; + return 0; + } probe_err: /* * Need to remove only drivers which were not probed before this probe -- 2.27.0