From patchwork Wed Aug 28 08:27:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shen Lichuan X-Patchwork-Id: 13780887 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2055.outbound.protection.outlook.com [40.107.117.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D54AEB67A; Wed, 28 Aug 2024 08:27:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724833664; cv=fail; b=Wg2SHEuLKJ9U+a4EwtBWLpO2vRbUjETZ27x0lgBqjbUOoXo08YeraaRvjv/NN2GDA/kzrOjrr85Wzop3hyNVeLBCBSYabSqHct0xDyY5oIYT6DWExAvUOqUE7gRdjlOZZV/QnmUIf+RTc9WV5FKExCYSAVBPFFf+2IzXRs5V8s8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724833664; c=relaxed/simple; bh=OLGjVgshBJEIYJLeJOJq5iyKQ3NuGlF6A3aF5ODGQxI=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=ZqpyrrNNomB7imZmvOFrGzJ/2wl/A6iPwjlkjB165HPl5+FSnL2lgp3H4ihYZrN+PFJ+KOB6XHmwAFwkT1LkXyINlMoNfK6e7ytYkrXo2xCb8ncdO7UNVrUhcHDFqne0mYs+asAGsilPIzF4+OMApvXH/uUK1Cvqfx+THvcWkj8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=qp0ofYhQ; arc=fail smtp.client-ip=40.107.117.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="qp0ofYhQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eY6OgTcYGJsXTSwsf9pkwyooFCz2AMNmYQv3tu3ukGSmvPDf9D28Uyuj4K2yCrfh5AYH8pMdnelW0HULm+A4UnXzzNKEssMFlJb65xmcr6JVV3el4vfQjje7+pa6S9bPuBfPgwWp1KPN7q10kI6NRZ6w0B/U2N6ogwFrpDLOplF1/SwtRZCU37oa5w40gxNaXCQZK2AD0yxZC/lz/GTLdvupHr4K6LMFYsMAzX/49y8yZWZxDscLXspG4rKgflkU2QrsKBHFi1oQKpTCJQmqBsSownpS7o8vcvOYoemygEYjpm1Lc1C282VL3mguZRPTsPqMqBjJE1UN49p27UL0nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=olFZB3Z/uStj57yUxOBDdSY/bjv95GDuaJAMLqHJ5oU=; b=EUV2+CKB634EBFleOVG5c0FVkBYKRKFK/aW05JDmy1qLrNXXgTYfLxigNtHr5YTGaeBNxTfH4FhmtMt33gxg6kGy136jckE59xSKZygGEDaPfCFs702IUH37Zux1QQdzI/PaFhVR4aAhB/kVRjRGaZyNjtPKTrkUMkKVJALUjsbh0v5YfkTFN0PpQJTUfMfvNnF5jW5r239qG+jJ/0DJCWQ1roJ728jzCMnti9dgMBXZHFIpbDB6ecZpUnybPAHuOQwaUFCGUryu34a2M2iVfSOjuHWuSx7o9U/JpyfFzt1nDDpM0gZ05wc/aOIHmrw5zebMlWb809kICZGqJGcykQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=olFZB3Z/uStj57yUxOBDdSY/bjv95GDuaJAMLqHJ5oU=; b=qp0ofYhQ2palNQvVsMZuU+6Nfuk96SrGvFpeoSb3mczC/pTh3Xl3pMii8Gwki4dAPN9eiDYjWln4P01A+24NXvuSLRHei8Ia1iAPZoX7BgpSljWjtq4YBn/k5dVI+37M5R35CwU7+pNalZGMefRt6yRBdeTIwftLTa/8EWYbDMHNtIczFOAefE+8azyHS63Bwe0vlfGg2tTLnRt29zeXRwwnLXU53DgjcDOale3gu0xBnK1q/RJiCrJt3u/irnWNscIPy2b2vDD8IGf84eJ0CodMOtBpNLgjQjod8FTy+SEFqG8GRsSZcfBClL4d3CnDJMBFd1VnZundtUYqk4rOMg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5899.apcprd06.prod.outlook.com (2603:1096:101:e3::16) by TYZPR06MB6024.apcprd06.prod.outlook.com (2603:1096:400:335::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Wed, 28 Aug 2024 08:27:37 +0000 Received: from SEZPR06MB5899.apcprd06.prod.outlook.com ([fe80::8bfc:f1ee:8923:77ce]) by SEZPR06MB5899.apcprd06.prod.outlook.com ([fe80::8bfc:f1ee:8923:77ce%3]) with mapi id 15.20.7897.027; Wed, 28 Aug 2024 08:27:37 +0000 From: Shen Lichuan To: dennis.dalessandro@cornelisnetworks.com, jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, opensource.kernel@vivo.com, Shen Lichuan Subject: [PATCH v1] RDMA/sw/rdmavt/mr: Convert to use ERR_CAST() Date: Wed, 28 Aug 2024 16:27:20 +0800 Message-Id: <20240828082720.33231-1-shenlichuan@vivo.com> X-Mailer: git-send-email 2.17.1 X-ClientProxiedBy: SI2P153CA0021.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::20) To SEZPR06MB5899.apcprd06.prod.outlook.com (2603:1096:101:e3::16) Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5899:EE_|TYZPR06MB6024:EE_ X-MS-Office365-Filtering-Correlation-Id: 35c3e47f-0ae1-414b-fd06-08dcc73b45af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: TrAYPYEOPpx9Zn73Pn8s3KAGIWDd6RkhAHzINi26VLseT6GyoUPO5kFBE0Im9gP63yAgFL4YnjZGSKa0q2amfAtbTGPo/XZpwf1XauSd0QepoyNerzupXOMm3aNG+/avrbxi47ZdLfWPcS6m5S7j+1Go5dvEFV1aJFZEQOvIqNEiCm5Eiw2BiiF/rIUWIYt3HsHc6X5DuXmJnCYIIUIR99nBaijit9PFVQiNJq0BDyyFr32mq9/1Lo9pfYp+GzTSpF4O/MAJEQMrTxbFvcwe0Q2jUSFVwBKr13pYV+a6hzO0J0P7a4ktH77LoIMVNZibCX+3SAq3RM1SufLCX1P3kLr4VKW+t/VF0raI6UrhOJC7g3U6SYOPBxVLrVvYebSfEa8Srsux7H7gyRSQZXV3bqzkxds8wIqmwmwiRvTtAxj4fniezEcL3h+OXZN1sGJzmlbJyicEcWEnEWzWPRxJopqealRgHxgZoS3j2yvwYZ12E8vVkbTZP0IV3Kz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FfR4jTX1+FTFlOn0zupGnpfHgRzGus9JGXs7/fs+7YB3JpW/OUTHy7dvL6JBdgJBasCVegEBRnBuiZYRIaW4JpGWjq356gV6Z5m6tcyM+EAQ2KCOqhNkP3UKD/I48Fuc9vcEBXNxfaPkYHSIwpFuC2ZuIYD8gzEkd1212XitFvlzPWc4JhTn5pWoA8IzZj0jNl+ZseM2CYOA6qz1CK3xqg3YmZVydddfiOcen2Y/PjP+OFJiPY1waJnwOKW8+dHw9ng1IIc2bDGtjht6yJTI6fKx3HHLrtuIm1wektfJIBAOm6gCYyvyi4+Nz71EgQRNXoyZ5MOOWyeohtiZVEQiFK9BZZT1R19f2gteu8AV+7V/H4M8FWPD7rlKVubwDXS7Q8HHOpK+fKapWZR6FMtaxVyzpWuHXa4LoQBWUjb30MadnvGGTkJsmOi7LONM40M8vOkkLWVUyZXeARZHCWjQ8Jgz5AXhqNPZGDMkTVFqO5owLfJEUuq5XS21RBV/9neZn2usQkhm5eDlp2To/0Z91qXRwMoudSPRKjXDuYJf+VFPkiFC3+QdccLRHCS+teWYM6urTOf0hthKZYEfY X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35c3e47f-0ae1-414b-fd06-08dcc73b45af X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5899.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 08:27:36.9597 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: glM9C31bnWrkkOb70BT49/Dan0MLqSVxOiOJRHi2x1WyxT6GntP3Fti6WWB6r+R8W2QGFoU1l17LS7ySLjDRUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6024 As opposed to open-code, using the ERR_CAST macro clearly indicates that this is a pointer to an error value and a type conversion was performed. Signed-off-by: Shen Lichuan --- drivers/infiniband/sw/rdmavt/mr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/sw/rdmavt/mr.c b/drivers/infiniband/sw/rdmavt/mr.c index 7a9afd5231d5..5ed5cfc2b280 100644 --- a/drivers/infiniband/sw/rdmavt/mr.c +++ b/drivers/infiniband/sw/rdmavt/mr.c @@ -348,13 +348,13 @@ struct ib_mr *rvt_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, umem = ib_umem_get(pd->device, start, length, mr_access_flags); if (IS_ERR(umem)) - return (void *)umem; + return ERR_CAST(umem); n = ib_umem_num_pages(umem); mr = __rvt_alloc_mr(n, pd); if (IS_ERR(mr)) { - ret = (struct ib_mr *)mr; + ret = ERR_CAST(mr); goto bail_umem; } @@ -542,7 +542,7 @@ struct ib_mr *rvt_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type, mr = __rvt_alloc_mr(max_num_sg, pd); if (IS_ERR(mr)) - return (struct ib_mr *)mr; + return ERR_CAST(mr); return &mr->ibmr; }