Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3289000lfo; Mon, 23 May 2022 00:48:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKJo3G9Yy6AisGURhbyPWWL3W0QscAZQv3F2VZBOkmmmx4baogPAHA6p8mjfkROR/IR0Hq X-Received: by 2002:a17:903:22c7:b0:161:cf2e:2ce2 with SMTP id y7-20020a17090322c700b00161cf2e2ce2mr21756614plg.59.1653292098487; Mon, 23 May 2022 00:48:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653292098; cv=none; d=google.com; s=arc-20160816; b=OCeNe8kY6tyZqDVKghd5ipCHTX5HVwG8rkH3lOboaPST5W8bFQ25QFzI69Vdczcn8z 0y/7YHxj0Oo4xYCa/U+hgz144BsLDjq0YapkaRbBP6EOkR+NOQHvBQjYZYNtvxHGg6x1 bRTTzW8QxYFzgI7jBYGqvmuUeO1aPFI9i5CkTwYjtPYWMDle8R60bclWXA7PF/Yf51mM hf1aFQ1OJ/OxhkYRw7IVnA8hqw1Oww8wffwgfu23CrNGMoAegxOPyAH6z+6HlY1YxGUc fEGskYOgxlacAQ+5diKt6oU30aM9R8sn6LdAv//s2YikLHkHj8gCiPTytySXXZMELCF0 zYsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=eEbIhLUiu2WS+BVQsyBtgU0HEDelK9cETiK11/Vt5BM=; b=BphGrQk/a3kdH2D4P+Cqfbiq9D/PAQ0NPKv6ZbzNemYicRMOQlrBcshPZwkuLvrlLD BWXseu4bCbEJd4deNHd4sdmh908ekxk/yPvaCChFlu+Xy2pW6ovLtOjPEqSYnmnoCvN2 FoYw/Ao13pOIsGU/9TwCeN9orICPY2qVKUrQyXGGRoEudY9K+uMeUn627yclMmdos7K1 N4A/02apeNSqYFozsl9/uvTq0gkJ4pfsSNkKiwdE68cus6WBIIrGT21cymm/jl3Z2Hns NKjDUsAWmjTvsnvyDeRmHCcRV4J4KioS4aGZX2MngR8i6oTbv7KNLFlqNrIA4g8T838u cCfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h12-20020a170902f54c00b00153b2d16507si9937894plf.271.2022.05.23.00.48.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 00:48:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E686A205276; Sun, 22 May 2022 23:53:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237912AbiETRVd (ORCPT + 99 others); Fri, 20 May 2022 13:21:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352110AbiETRVc (ORCPT ); Fri, 20 May 2022 13:21:32 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD33E1BE80 for ; Fri, 20 May 2022 10:21:28 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ns6JN-0006KE-25; Fri, 20 May 2022 19:21:13 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1ns6JM-003Wcq-7W; Fri, 20 May 2022 19:21:10 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1ns6JK-00B114-3B; Fri, 20 May 2022 19:21:10 +0200 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: Tudor Ambarus Cc: Alexandre Belloni , Nicolas Ferre , linux-crypto@vger.kernel.org, kernel@pengutronix.de, Claudiu Beznea , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org Subject: [PATCH] crypto: atmel-ecc - Remove duplicated error reporting in .remove() Date: Fri, 20 May 2022 19:21:00 +0200 Message-Id: <20220520172100.773730-1-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <7ffd4d35-938a-3e82-b39b-92e76819fa92@microchip.com> References: <7ffd4d35-938a-3e82-b39b-92e76819fa92@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Developer-Signature: v=1; a=openpgp-sha256; l=1834; h=from:subject; bh=gA8wq0ZCl1/fS/XbCP60/5QOOg3haX5yuDKAvNbEKLg=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBih831UtGTMJeJU/pnRA/AxHGP6a1bWuonNka+UeSG LhmyPICJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYofN9QAKCRDB/BR4rcrsCa0XCA CfmVKb2YMsH0Zl7PCCsNGIGjn1yetCEEIOcvzLGt6QAurwKlyzsYUulVuxtYPNAqQKRGk1In7wntKx Vc8Zw8ej+Uisk4/E/nOi7k8OKj31KUzqRN8Yyy0SqiEdp7G4KEv19Xlozmn1VMXNAjPg6/qo6IxLO+ GIKxaWjbo/hvr1/5VeaN2BWrLM2W7JGLQihQW5SJ6PR5bSTQxylR+Dm6Mbd/ofFUQs29ixzFce9nk0 R4XlGsc8cBZxtn7NftKmlmXNbJUK31hHyFMbTslWKrdt9UVWQGqhqa5rcV8kPULFbAhYKBTW5UVB0F ayk0yVrLx8Vge0by5NiGGmEmKDYDjY X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Content-Transfer-Encoding: 8bit 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.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Returning an error value in an i2c remove callback results in an error message being emitted by the i2c core, but otherwise it doesn't make a difference. The device goes away anyhow and the devm cleanups are called. As atmel_ecc_remove() already emits an error message on failure and the additional error message by the i2c core doesn't add any useful information, change the return value to zero to suppress this message. Also make the error message a bit more drastical because when the device is still busy on remove, it's likely that it will access freed memory soon. This patch is a preparation for making i2c remove callbacks return void. Signed-off-by: Uwe Kleine-König --- drivers/crypto/atmel-ecc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/atmel-ecc.c b/drivers/crypto/atmel-ecc.c index 333fbefbbccb..6ba38275de8c 100644 --- a/drivers/crypto/atmel-ecc.c +++ b/drivers/crypto/atmel-ecc.c @@ -349,8 +349,16 @@ static int atmel_ecc_remove(struct i2c_client *client) /* Return EBUSY if i2c client already allocated. */ if (atomic_read(&i2c_priv->tfm_count)) { - dev_err(&client->dev, "Device is busy\n"); - return -EBUSY; + /* + * After we return here, the memory backing the device is freed. + * That happens no matter what the return value of this function + * is because in the Linux device model there is no error + * handling for unbinding a driver. + * If there is still some action pending, it probably involves + * accessing the freed memory. + */ + dev_emerg(&client->dev, "Device is busy, expect memory corruption.\n"); + return 0; } crypto_unregister_kpp(&atmel_ecdh_nist_p256); base-commit: 3123109284176b1532874591f7c81f3837bbdc17 -- 2.35.1