From patchwork Fri Sep 6 10:43:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Yufan X-Patchwork-Id: 13793917 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from HK3PR03CU002.outbound.protection.outlook.com (mail-eastasiaazon11011025.outbound.protection.outlook.com [52.101.129.25]) (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 0713F1C8FAD; Fri, 6 Sep 2024 10:44:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.129.25 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725619491; cv=fail; b=Ck29axKcIt5W+LRdfqj1PXYq7VVJArkUT/G3YDxsCswrDcJ8icqsKlYkLHLZ4ZV/WGctDF5I2NN8xyxy5cM9FJhCcGrPd8aBH5LfF08D/B0Q1KB7XjkvaEjX/hID0i/bgCG4PN536WaKDmj8uLNUQjhMwnuoThylNFb0cjSP3yk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725619491; c=relaxed/simple; bh=CuWtT+PUMJlj9GKQe8N+d/lL+iEV4vfpsCijB/J5ORU=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=FU2oFPEDeN45HC3CW2UgLqBv6O22257uBS8YC4isWmlKugbqNTyTObrPIWHLhA63O/EbwE6UVr0SgnUB08k1Izv4199pbS8bAboJYwF4szAax+FEkdFvZf4oxaLsD/FGXr0buDFgk1M2VjzFfw0mVgH7cwP6qfuMpuD2y+nDUVY= 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=XdFHDQii; arc=fail smtp.client-ip=52.101.129.25 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="XdFHDQii" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GJoiCU5kC61es9Hutu7aGb+PSydGmluZJZ0blAmelRWc6QVs/SLvOq+Gt1A57LR5/3iQ1GskyDqdP2fgUWF5n6+sAbh41/hm4C8S3/UKTTUSO5z993JmG2i7sXDJQJjeK9amsKG8U440Xo0A8ZUuu45RYV1/ykQnKaK2vdBa0sUeh77eWRWom3npI6ou7yf2/d8IJdf/5VlgoAOjr1N8fyRmlbn1dUJQp5y9Y2zp1Fja1Q3hFykb8KKBABztaeMpelpsjf5hs2EawIMD0wDkKa2ih4OeHxl8b8X05NzRGQcvwTD6PQM58r0fuABHwIQ0FZImIoiROS5SmS3G9loZ+g== 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=nn5kJybRhNcgtICvULpOQehWH3H3qnMv5GmQ0Vcv4D8=; b=yk8DhIkXD9ptZSfyVB7l3WqY/W2hv3JeSI57gkVkxVt2dMoEi2v0vJeBUqotmoP5XEEwSDvRVp0My2DokNd+HM370JyHm1yLTD12AlMDeuOQOV1jOOB+vdMCqkcWMuVyl5yRAI8QReZIb0T+yTKLGkLUeIUuGnvpHJOqhR3gIH5EjBOeVVAbbuoLQ7Yj5bEGJvlgmn41R1/dRTZYFuNgeNqZbrOBDMI+y9ScsgmGIo0Og7lPiRarKm4ldBDCP+7aIr0GcoNfxymB1dVnxfiYSiipYEGEzR3RxpsWUu4QnTrtpXz0hW8Jhiba7CCEvB60u9yETFDSc2MF6rj8sf1HXg== 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=nn5kJybRhNcgtICvULpOQehWH3H3qnMv5GmQ0Vcv4D8=; b=XdFHDQiiJiFAn8hYHqMTnbeW/fd7akERLp5q8TASC5xKjuM3mfWxikSYZ5LeqXZyqPyp03VjCcUydd4lHlUhJxfnlo8N7LhckVJjvUB19MCbQ/W+btQNY99QmziP4CLbkHHqZMcwpqcw5W4kLP0D3vz5dZes/8XIHQqJv2NXCvD7HSpVjpdgbg2DZ9qLDh6k3rjMhzT/Nm/jXEZ+GW/+m0I7vGP1rxENcFHO5rLDu45ZHrzhQgKRpiZP9oV5svnHBGat6HQVHCvc2X8bWc8QIO5iQx7VijKF0bQ9zDlYmwRs/YsMEhMDxt6mkkweRQW+S2XO4u1yB2WZ4GGp5uDgJQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from KL1PR0601MB5487.apcprd06.prod.outlook.com (2603:1096:820:bf::14) by SEZPR06MB6302.apcprd06.prod.outlook.com (2603:1096:101:133::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Fri, 6 Sep 2024 10:44:42 +0000 Received: from KL1PR0601MB5487.apcprd06.prod.outlook.com ([fe80::2129:59e5:6c67:311f]) by KL1PR0601MB5487.apcprd06.prod.outlook.com ([fe80::2129:59e5:6c67:311f%7]) with mapi id 15.20.7939.017; Fri, 6 Sep 2024 10:44:41 +0000 From: Chen Yufan To: =?utf-8?q?Horia_Geant=C4=83?= , Pankaj Gupta , Gaurav Jain , Herbert Xu , "David S. Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Chen Yufan Subject: [PATCH v1] crypto: camm/qi - Use ERR_CAST() to return error-valued pointer Date: Fri, 6 Sep 2024 18:43:24 +0800 Message-Id: <20240906104327.72221-1-chenyufan@vivo.com> X-Mailer: git-send-email 2.39.0 X-ClientProxiedBy: TYCP301CA0059.JPNP301.PROD.OUTLOOK.COM (2603:1096:400:384::19) To KL1PR0601MB5487.apcprd06.prod.outlook.com (2603:1096:820:bf::14) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB5487:EE_|SEZPR06MB6302:EE_ X-MS-Office365-Filtering-Correlation-Id: f89e3f1c-8aa0-4175-4128-08dcce60e9a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: W6lWBa+cYzVMCEItuZsNV/j6v11a8W+YmNMcqwAkgYwFieHsY+ZOgAsHFYNANuj7H8Rri2gZ2ncT92A5+RcvEtfPut7Rxm+tceaJ+ev6lef1cVRQsHcsuS8y8clJQ+GrMn1fF1VtOvgNDs108p6kgXmc0t3/8YdJT+dkDotVPJbcY2PLHjNJi4VTKyr04zRQ2SevLpPV5J5j0TmazQSKwpZiplGJXho5bx7BTr1N5bhznLuY/waJ6vtZmkKc35tA9CDTD68LGhgpEOBNLhGhOcdAsf60wWTtdhCUYRuDtuGH1dqlxXeM50pTOqbEnQp4wfBXcqjvz8TBK7WR2pGqSMaClRZocenwtMeqLAcuFJIkMGYn3XxIW4e6O09nYSmmDEZWlJyuSvNZDpg6LDn/nSZcfDJHZvK6gEfhcv8l1cO2B0zKb3z6CJg6N7I0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B5487.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wS5doz007qmjH82IE7PJTkBOtDK7XyCazFHb5qTr5mgq2nxB08beMVPWnqCrYbUTtclz8ORZ3k8Gqfi74KFWx+c5gWn0GN06VvB2CiYTbsnYmwuoczp1FjIEj3gSt4UYuKNcVEkz7XGtI+l+ZtnODelqZD/1qwGZJeKbs0JkiR6T6h1ALlAOe7kfjdSmQArnLwqPEU8N3HfjDXKjzfATqau+BFsFO/8sQ1oRnErzPTWN2WOSQe6LLOOihhmuNZ8EomXETS5F8iqAxRL8DPvKls88AiwITH8c7ntBUDrfgd4sXLqzhNNbxi+EXicXuJ8/P0zQLc030H1/P0D0zScqS18friST7y9UrnvqvtCNIzvOWmeVcnI63lKJ1xpaNt9cAZ21bqZJVlxZzNONAalbJipuYj+Yes2h16ycwSIouHhBUxHbLX/1JjC1Lg3fOhWL5mGNHhwzUHLeh2jVYWoW1q6jbCFOsy3FfRSSsZ2xT9CARykugT2+D6VUd2VtC5oKJ4kgEI4yxlU4AspvpThRo32EaRWvlILgBezCpjJTnIaMZWXUv2+NWVjH1kKXnpfHcFm1B3Z9jrfjEJDgjKzBCRtY9e07kAivgJpJzhDt+2bRoBCUycg7zwRQQLEGvfNtUcBTLCp7Cr1se+PV3/KkMPMZdEb/LsaFBs/L1LNxohB2XYyFxIu5jHA8oId1HkaSZc6HS9oK3l2QMH2qJpLHRehsVBbwSFt2NQ2bI6tNULDrTizGw6Qjh6hwB82mQ4qrFYpdp1Iks1uk0Lx9hB6V6vbkhTG/Kj/VRVY26bbga3ZFLymm0uNTQr28VdkUq9zRgQS9JfdB3X7LV6N/QpJKMtC3NUQxgIlQC3kichF72mtfUvTCJEMgKmJMmnDZSbyQ22i9mlNYnqPhjQk751xLTh0fj3IjsOAUmtKul6615CAbN6PK6TZWtH8i+SHXxTft+z7W5kypk6bng5NKG8NbrISoJnlz3bhl5JhtSs8OEF9z0/rwM74jY4X8rOR/go4epWuo6ztSyw8WUikKsK3JNMBbw5K0VHY/ZSx1p5X3ED6nXbNhwHEUiINB8qrS5ewNxlLrlMm2URmbpziwdK9OBO0fdjIKZjyDS7M06qdM8hv9gvnBiq5+at7pd4z5glsbo5Gf5l9KBLK0CFZjAgSgUPrtdm2CF03zKShkKlPaEj/Jx70XLUKixapQh+HVKue5HMuAg84OW9hkx9ctp13qcmIEigUWUFzMca+8FHzJXNwNzELGbJ1JFYYu7hEr8oLeYLXS7x+LKhIESACL2UuS1Pdc4zWkfZQFoaBWiFqEUx0fNzaaxSQsvSGNO1erKdoDiwco/DCRQK/7ZmSjZ5CBtul9K/Ry8u9YZchTsiSXKeBjXeteAHyUFlWZkLmg0ds0aF0vf4UWlZmBGaA15YC9rg3Z4GB9lIp0+oJb3L4uO4nyO5r8uIhE9JMce0LPIARI2sEW4Pc9YUReYUfkOfALdjnsWapKGP1B+ic9h8VOVvnMJbB3Stkg4AmUACc856U3xA1HxskxnVpOQ1HMseOzLLwYjCANSE2yjWqlEFJVY+WDr6KO3cUz2BA5t8wrIUB7 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f89e3f1c-8aa0-4175-4128-08dcce60e9a1 X-MS-Exchange-CrossTenant-AuthSource: KL1PR0601MB5487.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2024 10:44:41.3438 (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: T6cMbkPLkVLwhfRiqXbLFG4pIJ6imsUmj36PLNg8LrsyIWAHmNqj4TTRgQ8NUhDc8m3PNUVuEJGB9rOPtc5ozA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB6302 Instead of directly casting and returning (void *) pointer, use ERR_CAST to explicitly return an error-valued pointer. This makes the error handling more explicit and improves code clarity. Signed-off-by: Chen Yufan --- drivers/crypto/caam/caamalg_qi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/caam/caamalg_qi.c b/drivers/crypto/caam/caamalg_qi.c index 743ce50c14f2..13347dfecf7a 100644 --- a/drivers/crypto/caam/caamalg_qi.c +++ b/drivers/crypto/caam/caamalg_qi.c @@ -961,7 +961,7 @@ static struct aead_edesc *aead_edesc_alloc(struct aead_request *req, drv_ctx = get_drv_ctx(ctx, encrypt ? ENCRYPT : DECRYPT); if (IS_ERR(drv_ctx)) - return (struct aead_edesc *)drv_ctx; + return ERR_CAST(drv_ctx); /* allocate space for base edesc and hw desc commands, link tables */ edesc = qi_cache_alloc(flags); @@ -1271,7 +1271,7 @@ static struct skcipher_edesc *skcipher_edesc_alloc(struct skcipher_request *req, drv_ctx = get_drv_ctx(ctx, encrypt ? ENCRYPT : DECRYPT); if (IS_ERR(drv_ctx)) - return (struct skcipher_edesc *)drv_ctx; + return ERR_CAST(drv_ctx); src_nents = sg_nents_for_len(req->src, req->cryptlen); if (unlikely(src_nents < 0)) {