From patchwork Sat Sep 23 10:08:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 726764 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CC98CE7A89 for ; Sat, 23 Sep 2023 10:08:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231243AbjIWKId (ORCPT ); Sat, 23 Sep 2023 06:08:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231136AbjIWKIc (ORCPT ); Sat, 23 Sep 2023 06:08:32 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 850AD19E for ; Sat, 23 Sep 2023 03:08:26 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qjzYe-0001jZ-NX; Sat, 23 Sep 2023 12:08:16 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qjzYb-008NfB-RV; Sat, 23 Sep 2023 12:08:13 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qjzYb-0047za-I6; Sat, 23 Sep 2023 12:08:13 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Daniele Alessandrelli , Declan Murphy , Herbert Xu , "David S. Miller" Cc: linux-crypto@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 1/2] crypto: keembay - Don't pass errors to the caller in .remove() Date: Sat, 23 Sep 2023 12:08:05 +0200 Message-Id: <20230923100806.1762943-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230923100806.1762943-1-u.kleine-koenig@pengutronix.de> References: <20230923100806.1762943-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1890; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=LhjfIChNQG3YZGP0Qkc6j8igCZe2ZQXcjnKCah+AcqY=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlDrkB/sjl5G4bSzBgL224F3Hkk1ZN2IxrcsPxd sMmJl+0LIeJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQ65AQAKCRCPgPtYfRL+ Tu/mB/96jxmK2pulSGLsHXibSRYoCx+vSr8yvFCh7BTiNNSw3+bl6Tm7lQlM+hajzJYPMmZejn+ 0A+AojrbdQEAfLrr2/tFNnhBW6YqJtqUyT3apEawYp1ZCmnNspsYV4gydzzsI7dt81cyD6gyBLU qYsZxtb02/F9y3rA5bgJBKm9Ba6U/+a6XSutL6z4pf22X4XTgRXrfM72UptLd1CzmX3aMbZROWu JaDejq4ngFI2lQvw5BXYzgD0OVOblwyWTmyPvvS4ZeCgnrUiYvW4IBzlfV8rgwS+kEnFU1EC178 mRG2cKtT4th/X1YPC1f8KnKwPLTe6myYti19odGIqHCO8xNO X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-crypto@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Returning an error code in the remove function of a platform device has no effect (compared to returning zero) apart from an error message, that the error is ignored. Then the device is removed irrespective of the returned value. As kmb_ocs_hcu_remove is only called after kmb_ocs_hcu_probe() returned successfully, platform_get_drvdata() never returns NULL and so the respective check can just be dropped. crypto_engine_exit() might return an error code but already emits an error message in that case, so better return zero in kmb_ocs_hcu_remove() even in this case to suppress another error message. All other crypto drivers also ignore the return value of crypto_engine_exit(). Signed-off-by: Uwe Kleine-König --- drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c b/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c index daba8ca05dbe..8a39f959bb53 100644 --- a/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c +++ b/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c @@ -1153,22 +1153,17 @@ static const struct of_device_id kmb_ocs_hcu_of_match[] = { static int kmb_ocs_hcu_remove(struct platform_device *pdev) { - struct ocs_hcu_dev *hcu_dev; - int rc; - - hcu_dev = platform_get_drvdata(pdev); - if (!hcu_dev) - return -ENODEV; + struct ocs_hcu_dev *hcu_dev = platform_get_drvdata(pdev); crypto_engine_unregister_ahashes(ocs_hcu_algs, ARRAY_SIZE(ocs_hcu_algs)); - rc = crypto_engine_exit(hcu_dev->engine); + crypto_engine_exit(hcu_dev->engine); spin_lock_bh(&ocs_hcu.lock); list_del(&hcu_dev->list); spin_unlock_bh(&ocs_hcu.lock); - return rc; + return 0; } static int kmb_ocs_hcu_probe(struct platform_device *pdev) From patchwork Sat Sep 23 10:08:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 725617 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5075ACE7A88 for ; Sat, 23 Sep 2023 10:08:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230426AbjIWKIc (ORCPT ); Sat, 23 Sep 2023 06:08:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230299AbjIWKIb (ORCPT ); Sat, 23 Sep 2023 06:08:31 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33FD2199 for ; Sat, 23 Sep 2023 03:08:22 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qjzYe-0001ja-NX; Sat, 23 Sep 2023 12:08:16 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qjzYc-008NfE-74; Sat, 23 Sep 2023 12:08:14 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qjzYb-0047zd-R5; Sat, 23 Sep 2023 12:08:13 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Herbert Xu , "David S. Miller" Cc: linux-crypto@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 2/2] crypto: Make crypto_engine_exit() return void Date: Sat, 23 Sep 2023 12:08:06 +0200 Message-Id: <20230923100806.1762943-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230923100806.1762943-1-u.kleine-koenig@pengutronix.de> References: <20230923100806.1762943-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1804; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=oGx/T9R7JDurOdYPHegJL1iwZNpx/77lykGWyxyua/k=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlDrkClrT0fOZUDH0IoLSiJBh7iUBet33jQ9wCR hWJPlhlKtyJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQ65AgAKCRCPgPtYfRL+ Tr34B/41OVw/FLj/PeGxTwGskAfoT1Pf7Ziot5aGnHoB4z6S7ho/AGKPR7uhIZ0+9P/Zai7c8pR /4WwKh9T+ffAFVGv9G46uOUEcXMldphHSL4YaMcGeiFMbFjQdX45rkH4360DnEf6l8ggE+dNNay eYtJxhKvG/ODzGQ/tN56ckh4ECiW4uraeNPXMs6+b4NIgPcGbHKfqSICM1tZ/FtlN+pob0OahC9 3iFUanuvResYPJVtthrdeRbvG12upDwv+VyTOex/BDuqR6tZWUKPY8RxW2PDiYnWkc2TPwci9Aa RCsOMNy6V89Y0fRVTEjsv6s5WrBLsWOo8+ZIyBAufCMF4/9z X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-crypto@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org All callers ignore the return value, so simplify by not providing one. Note that crypto_engine_exit() is typically called in a device driver's remove path (or the error path in probe), where errors cannot be handled anyhow. Signed-off-by: Uwe Kleine-König --- crypto/crypto_engine.c | 8 ++------ include/crypto/engine.h | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/crypto/crypto_engine.c b/crypto/crypto_engine.c index 108d9d55c509..e60a0eb628e8 100644 --- a/crypto/crypto_engine.c +++ b/crypto/crypto_engine.c @@ -552,20 +552,16 @@ EXPORT_SYMBOL_GPL(crypto_engine_alloc_init); /** * crypto_engine_exit - free the resources of hardware engine when exit * @engine: the hardware engine need to be freed - * - * Return 0 for success. */ -int crypto_engine_exit(struct crypto_engine *engine) +void crypto_engine_exit(struct crypto_engine *engine) { int ret; ret = crypto_engine_stop(engine); if (ret) - return ret; + return; kthread_destroy_worker(engine->kworker); - - return 0; } EXPORT_SYMBOL_GPL(crypto_engine_exit); diff --git a/include/crypto/engine.h b/include/crypto/engine.h index 2835069c5997..545dbefe3e13 100644 --- a/include/crypto/engine.h +++ b/include/crypto/engine.h @@ -78,7 +78,7 @@ struct crypto_engine *crypto_engine_alloc_init_and_set(struct device *dev, bool retry_support, int (*cbk_do_batch)(struct crypto_engine *engine), bool rt, int qlen); -int crypto_engine_exit(struct crypto_engine *engine); +void crypto_engine_exit(struct crypto_engine *engine); int crypto_engine_register_aead(struct aead_engine_alg *alg); void crypto_engine_unregister_aead(struct aead_engine_alg *alg);