From patchwork Fri Jun 3 21:07:52 2022 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: 1638871 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=wDj6Lbob; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LFFtl5bmrz9sGf for ; Sat, 4 Jun 2022 07:11:43 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=X1YHCphlzPCvfV4n1PxQrpNCYomur+GT2NJeq0IX/G8=; b=wDj6Lbob06BQEQ oiwyS8J8Tm/VsISwv2/hXQVCQ0B3PW+gXal6Ipi1RtZX10FoSO3qtyTgoWHGuvbMX+38YWvTkB/7c MLvllGqLLt08fLSE14ab1WiJilcWj6x27KR8TVGw/1hGUyKS1h3cz4z2tRKapTIUWbCthdFaCP03M BMeXStneB/H5jmpZcMzSc+cIU++5ea9B8gYh2AEbMUjxdCfVvqHY/+kIIQfm1b2IS6BWcht/bRQqL ozEO8yjo2Blcan9X4M4qLZEB2mwylSir0tlOsNZ2VtpISe3PrThkmJUGOV2Oj1LTCLFZdv00Y1Gwa uNAa668JKDUHknX/aZzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nxEZZ-008jDq-Ki; Fri, 03 Jun 2022 21:11:09 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nxEWw-008h4J-Ji for linux-mtd@lists.infradead.org; Fri, 03 Jun 2022 21:08:27 +0000 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 1nxEWc-0003rK-S9; Fri, 03 Jun 2022 23:08:06 +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 1nxEWd-006HqM-Ey; Fri, 03 Jun 2022 23:08:06 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nxEWa-00E1HW-Q6; Fri, 03 Jun 2022 23:08:04 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea Cc: kernel@pengutronix.de, linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 08/14] mtd: rawnand: atmel: Warn about failure to unregister mtd device Date: Fri, 3 Jun 2022 23:07:52 +0200 Message-Id: <20220603210758.148493-9-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603210758.148493-1-u.kleine-koenig@pengutronix.de> References: <20220603210758.148493-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1323; i=uwe@kleine-koenig.org; h=from:subject; bh=w7t3z1XUI/STdrsUUjD1Zed5MVKtRFjcH07jBAY9g6c=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBimnfeF/dYwuJXY8Jg4msHfPQvAz1kd7FIE1gdvMiJ 2sLe5dyJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYpp33gAKCRDB/BR4rcrsCR+/B/ 41uPhowocJ6NtP1+EEFqzGIx0uufPzBz2XJqWYskZyDB+XNb1/vTAhlpA+xQOWY/0aKjR2fdlrbe8c aXFy15gE9tOqKlV26tCPqyLsKJ1xmI4SP5ARYbTnjCTJUpiVAdGxsEKcjuy7uqlMjJK1hBWZ86oV2n hn1Fg7M85zV0h/xy0DsaU9EboSMEm2EpfvxykSHxcmkKmCAOj9f85I2c8rjWrjrCBvff44sliN6yoL nEwcANB0oRm9IMvSkDG7IVQt6nENLWP6TEkSfaUP5bWEAQi7A2/jfJuL5Ld8ts7hQTWZD9Bm1bepuS eQLlw5HiKP5/DLd3RyK0cxIVgvzAuX X-Developer-Key: i=uwe@kleine-koenig.org; 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.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220603_140826_689555_B124BC19 X-CRM114-Status: GOOD ( 15.43 ) X-Spam-Score: -2.3 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The Linux device core doesn't intend remove callbacks to fail. If an error code is returned the device is removed anyhow. So wail loudly if the atmel specific remove callback fails and return 0 anyhow [...] Content analysis details: (-2.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [2001:67c:670:201:290:27ff:fe1d:cc33 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The Linux device core doesn't intend remove callbacks to fail. If an error code is returned the device is removed anyhow. So wail loudly if the atmel specific remove callback fails and return 0 anyhow to suppress the generic (and little helpful) error message by the device core. Also check the remove callback to actually exist before calling it. That might happen if nc->caps->ops points to atmel_nand_controller_ops. This is a preparation for making platform remove callbacks return void. Signed-off-by: Uwe Kleine-König --- drivers/mtd/nand/raw/atmel/nand-controller.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c index 6ef14442c71a..bc6ee694f4e2 100644 --- a/drivers/mtd/nand/raw/atmel/nand-controller.c +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c @@ -2629,7 +2629,10 @@ static int atmel_nand_controller_remove(struct platform_device *pdev) { struct atmel_nand_controller *nc = platform_get_drvdata(pdev); - return nc->caps->ops->remove(nc); + if (nc->caps->ops->remove) + WARN_ON(nc->caps->ops->remove(nc)); + + return 0; } static __maybe_unused int atmel_nand_controller_resume(struct device *dev)