Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1170446lqa; Sun, 28 Apr 2024 23:23:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUoXE4gseRQcGJ6DW8s6J33iMM3AyWRuHMAbw3bJ+8tDiNiYVBRUhmENStt5ZjO0TDTzBRQQDzspt/AunK5AV4TW0hiWfuafDC88Y/OZw== X-Google-Smtp-Source: AGHT+IEqk5kN+dcobOlEoM4vjUplaqghQSpkFSP9bxYJk/6ddssIfKd1sZ9HTo7mFZ1ZqxsgvvHz X-Received: by 2002:a17:906:3404:b0:a55:aded:200d with SMTP id c4-20020a170906340400b00a55aded200dmr7749986ejb.12.1714371797400; Sun, 28 Apr 2024 23:23:17 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a20-20020a1709062b1400b00a58bfc20ab4si4143697ejg.222.2024.04.28.23.23.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Apr 2024 23:23:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-3913-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=fail (signature failed); spf=pass (google.com: domain of linux-crypto+bounces-3913-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3913-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id F35521F2224D for ; Mon, 29 Apr 2024 06:23:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E5CDB14A8D; Mon, 29 Apr 2024 06:22:46 +0000 (UTC) X-Original-To: linux-crypto@vger.kernel.org Received: from CHN02-SH0-obe.outbound.protection.partner.outlook.cn (mail-sh0chn02on2112.outbound.protection.partner.outlook.cn [139.219.146.112]) (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 CBE1512E7F; Mon, 29 Apr 2024 06:22:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=139.219.146.112 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714371766; cv=fail; b=aijH22b9w6H75XPW6E34pjcKzE7YTjytpDypC86Ap/CzWM9DHR0bTC5/rieyu736LHy05HDt8ANZy02SQqkGacoqFLAg9zs8mX4h9Mxz6YFUgtA/jH/pIEa+paL5iyw4TR/5Qdx+RStPyBk/U2/i968nehE5QKgw6hBTetlU98s= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714371766; c=relaxed/simple; bh=zufFHnhH5XeDX1xkJvhyRJw0GDJeJq3EOxLdjGCFjug=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=PQHiS5WXXI6mOB/Rtu5mO5G+IAHlLjatnj+LAQ8JVeWaD/D7CmdAUfpEce/j/uTOID/ULedEVQl8+MTw33o9heNuXEC8I2o+0j1XZrS6xy9K87+IyflQ3kzgZxwa/emNbrmRgBrV8kfNF5GR8MVSwxwc7k48bBMeKQynMLcEKoo= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=starfivetech.com; spf=pass smtp.mailfrom=starfivetech.com; arc=fail smtp.client-ip=139.219.146.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=starfivetech.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UV/5tzZhWgN+28aHb2xCAX8XkFY8kC9dqbyMWYyDBg1KPYYih5b0sXE4B/JESAon8lq5+p3eUHUb5qmpG+maiPI6oEtXWCuwvOqX5LFhmGVrY8EpdkytGiDZ54VscoQlmwNsoDTmdVUNf7uiEfRPRZSmY0OfHiraq8tAhz3Rvb9UvkMMf4FVtUeVB0ISJGKnQqCJRSss9uqZKpa07gGXjyXgW7YL8MyCHodrmTCG4AsuaLjaOYuMWeKpyXvzbJS5UCjdX9XDBAit5qSMCxP5TDceMpg+vRb4Y6c6U4uPrxVtBT1OFFIY9dsgp7Wpod0QeYD21hSm6kDiIw2YDUlFBA== 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=k2CrA8HwvGDCPolvpYiZEw8jeVztb4IcpTumyGyYZY0=; b=hMp2esLbbgdJvrwygQi8AXy4X8WOppd84F6ucs03u0oQywxMEpJLf4+WrhdOwgCnk3k9vYXNUjz9HJojsvIuQz3YSZiUWu+iT1FgYx0yXyjZes5P4sUrrnqS/97A1wK+sKZ3aaha+dzNm+Mfiz89+ruGCFqdHjcMsdyoPcVIkH5VoMVM8a3RcqMVTHRabK5JenaVtS3mKJO+4abhkdYxhzF7nn7jscd7SI6yiQ0fh5SiNvobA182VQJ+/sE5XhRr9I0FCvgRxqQN5wMde7Lo6/1BGQbgSEuJPjiq7TLwNqqbEQQEi3LeDnsykZ4wUhX9xe5IP/eC3NF0So7k97OaMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from NT0PR01MB1182.CHNPR01.prod.partner.outlook.cn (2406:e500:c510:10::10) by NT0PR01MB1278.CHNPR01.prod.partner.outlook.cn (2406:e500:c510:12::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Mon, 29 Apr 2024 06:07:57 +0000 Received: from NT0PR01MB1182.CHNPR01.prod.partner.outlook.cn ([fe80::3dc9:e0c9:9a09:3bb7]) by NT0PR01MB1182.CHNPR01.prod.partner.outlook.cn ([fe80::3dc9:e0c9:9a09:3bb7%4]) with mapi id 15.20.7472.044; Mon, 29 Apr 2024 06:07:57 +0000 From: Jia Jie Ho To: Herbert Xu , "David S . Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH -next 2/4] crypto: starfive: Skip unneeded fallback allocation Date: Mon, 29 Apr 2024 14:06:38 +0800 Message-Id: <20240429060640.2451685-3-jiajie.ho@starfivetech.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240429060640.2451685-1-jiajie.ho@starfivetech.com> References: <20240429060640.2451685-1-jiajie.ho@starfivetech.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: ZQ0PR01CA0034.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:2::12) To NT0PR01MB1182.CHNPR01.prod.partner.outlook.cn (2406:e500:c510:10::10) 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: NT0PR01MB1182:EE_|NT0PR01MB1278:EE_ X-MS-Office365-Filtering-Correlation-Id: 9320845a-a264-4d73-61de-08dc6812b70b X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EWcWVrMaSG+Ndp46oPkAo43E/hvz3b0ieGs6seSLQY2B2wUKkk1kATUqHShgI2DQ+oQont1YLCrCmMbNuFzjDvbImTRLGvlaqYbyO/DvURtTjAU6fI67aezd/RGw3RJ2RXuQLoRug0eZbA/FK0xtu6Zu4qA6bWlttT+x5XqhzibKE4/Be5Ldcqf8+LMlmxq3kUh/vBSVXwqS+q38nEUpwJ85f/ve4X2sSrqDUOjq5oBw7Mt15ynsg7FGh0qNU63G+WX8lWHQR4JL19crk/BnviXYi0H+mWQ3wLWCPu9vU/Y30/7HA3JV0QPiHR0+j3ex6X3pGo47FqZbfJfjrBEcaR5cGOMYd9DmaCqdcbgecsSgOyr8IzeUdmNVZ5LD3RCdeXaljqIxFMUELyizP1o/vZNTr+2I1Dws92ZVbAkbWtI7lkO5okjgDJ0C6EjAzNj4N7/jWEz/NHeK/3I2XzliexnKWCt45rui2vrgpeGBdgOgS3axoRjqahCsCijzrTXzDhqe1XDlYTHDeker2iVumZOOBcU3Xb3YuxnjRG8tluXRrMdBVvefiuy/UQuKTw0mYAOOO13YFYnwJ+r2XQ8P97YOQt9euZWydaWZWmwJ5/KPug7ReFyEGFRH0G00yd8o X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:NT0PR01MB1182.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(41320700004)(1800799015)(52116005)(366007)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?YSnluGdoPgc6KGtgPcuO8kbvOYrx5X9IW1X57dbW9D//ZEfavR+Fkv5gdB9T?= =?us-ascii?Q?ndRXbRDIeaMO3Nats6vlNGQeYEa5aieVeHaU9QGE61w650Z0Q7pSwjpoFG4V?= =?us-ascii?Q?W2+pTELK5S1a/0/vXjTIYDo3RQ/3kgnwsSdG4u3jlRPJBwys82HrKLB/PFqR?= =?us-ascii?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kSisLa/cuk7AdyiOmx?= =?us-ascii?Q?oizU+UuUl7gX2fDxQP5Q/GsNVhg4moBz9J6kQM77eoaLywT5sQvH3y5c6b00?= =?us-ascii?Q?yuKVtYbpgiONneylBzTknWI4YXreDzHMI5Fe6PLdi05WMXsYO8DRbRDiQPcR?= =?us-ascii?Q?9B0rd349aPKAnGo+nL/4IxXQbCesfFr/ibcuo1tpDKQHxgwiiba36ISacJ47?= =?us-ascii?Q?THqQd+cUAw0Jk3L5zgna8FUwGJWhd7QYv123vHh5o3YyI1LMBe5V4UgEct6/?= =?us-ascii?Q?WKGmph9r95ApgbGcma72XJ5iKEnCmUkXIg4LORH4n2XvY6RCEJA7Hk8xmqH/?= =?us-ascii?Q?rD0e3tI2ABMdlFCEzvYYB1a/cwjwnMQ+PQzgH1mS1j9xW3Ey0C0h+ywPeYYu?= =?us-ascii?Q?1TZt/GWiDlnytJ3/BUUHc5X1JpbEvuqK3RXN1ardU58bK0BkA0sYGk3vjQfa?= =?us-ascii?Q?h0wg60ZSVVK3euw/kT9Rue3MpIuxO3sNDqk3zAyXBY5JYAN/KfSUjgOiyvnT?= =?us-ascii?Q?A2TpQEH+H7Yfmx/4LI6VSVsFahAF5scay7ssOpDhjqCo6a3u2eOhtjhr/0bO?= =?us-ascii?Q?QA=3D=3D?= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9320845a-a264-4d73-61de-08dc6812b70b X-MS-Exchange-CrossTenant-AuthSource: NT0PR01MB1182.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2024 06:07:57.1709 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YOypm/fFQ6gHL4Xz8W6p7MTYi5156gkbi2gJ7grPJm5PZEYZDT6ZzyrbpD1lQRazR4xdFg+joNh85yyav8XZImKHZie+mQEubZFXKPJttkk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: NT0PR01MB1278 Skip sw fallback allocation if RSA module failed to get device handle. Signed-off-by: Jia Jie Ho --- drivers/crypto/starfive/jh7110-rsa.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/starfive/jh7110-rsa.c b/drivers/crypto/starfive/jh7110-rsa.c index e642e948d747..4d7eb3d1e764 100644 --- a/drivers/crypto/starfive/jh7110-rsa.c +++ b/drivers/crypto/starfive/jh7110-rsa.c @@ -537,16 +537,14 @@ static int starfive_rsa_init_tfm(struct crypto_akcipher *tfm) { struct starfive_cryp_ctx *ctx = akcipher_tfm_ctx(tfm); + ctx->cryp = starfive_cryp_find_dev(ctx); + if (!ctx->cryp) + return -ENODEV; + ctx->akcipher_fbk = crypto_alloc_akcipher("rsa-generic", 0, 0); if (IS_ERR(ctx->akcipher_fbk)) return PTR_ERR(ctx->akcipher_fbk); - ctx->cryp = starfive_cryp_find_dev(ctx); - if (!ctx->cryp) { - crypto_free_akcipher(ctx->akcipher_fbk); - return -ENODEV; - } - akcipher_set_reqsize(tfm, sizeof(struct starfive_cryp_request_ctx) + sizeof(struct crypto_akcipher) + 32); -- 2.40.1