From patchwork Sun Oct 8 20:01:24 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: 1844962 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=Rbl6yktk; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=oOM5Ygs+; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y6J4nX5z1yqP for ; Mon, 9 Oct 2023 07:04:40 +1100 (AEDT) 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=uXsdmQtx3gJ6U8FW6C1LVd79g+rRrAWgN9birLZpqzw=; b=Rbl6yktk6wimgT yQJNB+IY0NLC6MCmnzvvaqofzkQyRX7Ot3F4BzTONWvjk1uxoHunr6vvOyrZlSA3g5JzA1/uTa8Uj 4EMfwdRHBsjZjj/SHpjs8inv9L7G4LTrjJKy7geGb7C1hbJfx9X2HMRTCqUs5GSkuiF2L40HwikWN 66Jv5n6O1DGHPZysan8seEhz/GZQIfJ59M5C/siN93/dZLfJOHUwD7xVxsGYbKL3rOqTcii+CBtlm ra424WO2Gqw3cj30oEnaxbn7taSwehnUhBKSasO4EImdyE7kM+CJ+q0WTrYE3RjOWQevTjjUfkH7Z 2b6/SP3646ExgteGLrZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpa0i-009FKW-0K; Sun, 08 Oct 2023 20:04:20 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpa0f-009FIL-3D for linux-mtd@bombadil.infradead.org; Sun, 08 Oct 2023 20:04:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=tInNTwkmCNZzTXyG2xXUMew114Q6PUbFCMj23xKjqV8=; b=oOM5Ygs+Y0iwGMLpuiMcj8APu4 2QM7aojlQ4cQ8f4vxmfpj+htcqtSU3bOu5HL3XKtoBtVyKP2Dk+AZvypipnyt1QZuYAv7Lo/Dm25u kVLSC9qosWkKXEj3JWOqiePJeTVUz5nhuhGZFlXiq7RR2zAwgXgVKwEUTU4rfHBh4egsUBtKPsqlb eSwKop30pyg7LkkbKOO4aJCBUyZbYhi1JMGB34yNdGjBqWj5Lsvm0aXpcK6kk4MvjH3KTIVxQnOLv lTTC/8RFutitnbyCEdHKAwvsCfLIkX+AHkrSLrMrrk2NOYKlXWPLU1vebdN7lvJPh3dkL/qypC9tu 4CIMcU0Q==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyc-00ExWG-1f for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:04:14 +0000 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 1qpZyN-0001S4-Rx; Sun, 08 Oct 2023 22:01:55 +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 1qpZyL-000EzB-BW; Sun, 08 Oct 2023 22:01:53 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyL-00Bezz-2C; Sun, 08 Oct 2023 22:01:53 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: David Woodhouse , Atsushi Nemoto , Andrew Morton , linux-mtd@lists.infradead.org, kernel@pengutronix.de, linux-kbuild@vger.kernel.org Subject: [PATCH 01/20] mtd: rawnand: txx9ndfmc: Mark driver struct with __refdata to prevent section mismatch warning Date: Sun, 8 Oct 2023 22:01:24 +0200 Message-Id: <20231008200143.196369-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1681; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=HCTLmKUM6J3s+U8+meq2ryRrLbcxRn94rcRCl9GrZF4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwp5T8JGhAN448mWVi6r0ql9MAkFkY7cHU62g Y+eHndKpviJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKeQAKCRCPgPtYfRL+ ToeyB/9QNdWwPK2QFim3ThZYyJ4M+3DAU9OP7Wn96T5Rc68p/BsG0o6Co8IQG8J3PHulnFVrmv1 2lfvDiAQFjGX8tsDUGywbAvL7iKLvCVGhtjNEVYHNp5fchQ2rvdzOemgn9BQmmLaiWysMsYKRjs cKKy5h4fPWElhre0NZ64Wsl1O3ybsZTMJPqVru4OJHbJmaSbkinIoHdMb1Neefph/PHSP3myx3o woq3GoTMA4NpqprTsJEQfYrZDAPJGCSKrhMvPlUZx253H95gKjsF+IrVFauhspwb/sIS19wgYei NiMoeV06pKGco1cAmOg3+tw+R+IZ2bAsSGnE8L7E3VvaATrb 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_210214_634883_529AEF5A X-CRM114-Status: GOOD ( 14.77 ) X-Spam-Note: SpamAssassin invocation failed 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 As described in the added code comment, a reference to .exit.text is ok for drivers registered via module_platform_driver_probe(). Make this explicit to prevent a section mismatch warning with CONFIG_MTD_NAND_TXX9NDFMC=m: WARNING: modpost: drivers/mtd/nand/raw/txx9ndfmc: section mismatch in reference: txx9ndfmc_driver+0x4 (section: .data) -> txx9ndfmc_remove (section: .exit.text) Fixes: 64fb65baffa5 ("[MTD] TXx9 SoC NAND Flash Memory Controller driver") Signed-off-by: Uwe Kleine-König --- Hello, note this warning only triggers with f177cd0c15fc ("modpost: Don't let "driver"s reference .exit.*") that currently waits in next for the next merge window + building with W=1. Best regards Uwe drivers/mtd/nand/raw/txx9ndfmc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/txx9ndfmc.c b/drivers/mtd/nand/raw/txx9ndfmc.c index eddcc0728a67..aff9d6f16851 100644 --- a/drivers/mtd/nand/raw/txx9ndfmc.c +++ b/drivers/mtd/nand/raw/txx9ndfmc.c @@ -406,7 +406,13 @@ static int txx9ndfmc_resume(struct platform_device *dev) #define txx9ndfmc_resume NULL #endif -static struct platform_driver txx9ndfmc_driver = { +/* + * txx9ndfmc_remove() lives in .exit.text. For drivers registered via + * module_platform_driver_probe() this is ok because they cannot get unbound at + * runtime. So mark the driver struct with __refdata to prevent modpost + * triggering a section mismatch warning. + */ +static struct platform_driver txx9ndfmc_driver __refdata = { .remove = __exit_p(txx9ndfmc_remove), .resume = txx9ndfmc_resume, .driver = { From patchwork Sun Oct 8 20:01:25 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: 1844958 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=LgGEfoMN; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y4B4TNGz20Vh for ; Mon, 9 Oct 2023 07:02:50 +1100 (AEDT) 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=KPsMQs1nELIsyuXR/QZyZ19dNPWnnbBpPkDL8BVWuuQ=; b=LgGEfoMNQjwcHN pkHt7we6la2n/Xb1alC/ow8/iqbAXM6zldLXuP5Sg3gP7f/8g5uxt3gZYbEWMhFD6Nj4Ct/HDgPY6 DIF0LnA9cXjaVSYvTA2vm5QzWUkhu6FGhvXWxK2Nd/7EZrgE3S6AeY6KtRgKyF+EhUimbHyyXcIGM ejVYjdpa4eO4cbr7x0OEuPggneLCwXQXazm47ViNPuo5eym8uIeXwB0n10d9jJdjLy957YjQLnOQ+ fjI6FexShwuviIxtLHqkrGKpW16bH7UiD8cS7BkVsyQx8WZC+RF0HRdzRyffJiC9FNo92QXWFdyOF vC9dk15rGQ5vuSc5ixBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyc-009Dx1-37; Sun, 08 Oct 2023 20:02:10 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyV-009Dqr-2D for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:07 +0000 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 1qpZyM-0001S8-4w; Sun, 08 Oct 2023 22:01:54 +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 1qpZyL-000EzE-K3; Sun, 08 Oct 2023 22:01:53 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyL-00Bf03-B0; Sun, 08 Oct 2023 22:01:53 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 02/20] mtd: rawnand: txx9ndfmc: Drop if block with always false condition Date: Sun, 8 Oct 2023 22:01:25 +0200 Message-Id: <20231008200143.196369-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=961; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=xY4iFlBn+hA89YIz+7BM4iDNw+9PSlnUUQWNlfeNif4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwp7MlxrTM1knwjZE8C19e4mfq1I6PLEE7mAs n5q+/8IoLOJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKewAKCRCPgPtYfRL+ Tv96CACQU6OjG+WM+qcRk9cQj0hMJ5L4mqHHeoTYpdZBCQgZLPuU+T9f0IepfT4UM1PaFe93RYC muswZ8OY3JM0irVwDF0CyyDCEWcfKh7K12ZF1JNuhgbsMrPK+dIi3tnqfQmZNUsYHv5ra746yVW BJgGzCruUnxsV/prPv63dCNnKP3Ca7LYQEQpTfUhQ3Y4qevT2rCtF1JUOYkWN/rl4BY15Pyf3pn GV25WG5KJqg2md2KhiVI2v6II4nWwKZNE5DeH+PN+/CgH5JXKlteLvhLvT5fJo+YbaVuZcYveTh ZZBPQm+glGExf38jmne7LhfxpRZs4qZ3q4at5hwLXnAT9sND 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130203_720411_2123B98B X-CRM114-Status: GOOD ( 11.49 ) X-Spam-Score: -0.7 (/) 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: txx9ndfmc_remove() is only called after txx9ndfmc_probe() completed successfully. In this case platform_set_drvdata() was called with a non-NULL argument and so platform_get_drvdata() won't return NUL [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 txx9ndfmc_remove() is only called after txx9ndfmc_probe() completed successfully. In this case platform_set_drvdata() was called with a non-NULL argument and so platform_get_drvdata() won't return NULL. Simplify by removing the if block with the always false condition. Signed-off-by: Uwe Kleine-König --- drivers/mtd/nand/raw/txx9ndfmc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/mtd/nand/raw/txx9ndfmc.c b/drivers/mtd/nand/raw/txx9ndfmc.c index aff9d6f16851..83dd092d22ee 100644 --- a/drivers/mtd/nand/raw/txx9ndfmc.c +++ b/drivers/mtd/nand/raw/txx9ndfmc.c @@ -374,8 +374,6 @@ static int __exit txx9ndfmc_remove(struct platform_device *dev) struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); int ret, i; - if (!drvdata) - return 0; for (i = 0; i < MAX_TXX9NDFMC_DEV; i++) { struct mtd_info *mtd = drvdata->mtds[i]; struct nand_chip *chip; From patchwork Sun Oct 8 20:01:26 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: 1844956 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=nsEsEpJB; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y4964Msz1yqP for ; Mon, 9 Oct 2023 07:02:49 +1100 (AEDT) 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=FBsi3C+9zy1GBAs+5VCRgVhJmrRj9XzLBI89aZBH/C4=; b=nsEsEpJB+u/mU+ IbGYH5RvOPRVMU9NWBL5KI/thV20p4YubZXwQdtIMcrE9xBm2XCPTd4aJyH5xFLsXJqMuPu/JHLye SOEGKZcTL0hvvcn+wcOEUhftu7b9T2rf2wLkL8mH+Q8KS/AXs+1fGDH/xLiW+Uizu3uDD/3xUPBYu oyGbQoKqYauKl0OowObmFs+tYEesZwOHgB0TJR9m2jWAcGAHRWNBOPXXjCADKxnGvwoFV2kA109nu ne0L0cK1hSMFc5JTTB9I6nx05VFOt3DaZBRjOkeQa3IkK7ntLblcA5O4zgww9X1yl3LpvkKfS/4s2 uOSuIzYRSTemjrSIemWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyZ-009Dv5-1k; Sun, 08 Oct 2023 20:02:07 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyV-009Dqb-1W for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:05 +0000 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 1qpZyM-0001SM-Ca; Sun, 08 Oct 2023 22:01:54 +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 1qpZyL-000EzH-Vf; Sun, 08 Oct 2023 22:01:53 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyL-00Bf07-M4; Sun, 08 Oct 2023 22:01:53 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 03/20] mtd: bcm47xxsflash: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:26 +0200 Message-Id: <20231008200143.196369-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1707; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=8L087lsHdadPRL+6+A15IYiahQ9MePUiLPLe532Be24=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwp9jIeqQgIIv4zXX2m31HB6PoAb3mqGajgzs VoK34PEPaGJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKfQAKCRCPgPtYfRL+ TkVfB/9C1UGGdjmaDp7hkukW1xUeBmlOQjtfTaMmONZ8OLqNyumrMCsxE95xAM7pmOnQOXx0Lk8 CQNUmZkskRftFX+gna4YJF96YzgLPy68FqzPGBOnA20ophmf8KO2+jat7agHlp3O3Fb1xojUcqV Ba312U4efDh2BQROEG4Mu4wjwmkqBhqj7F6ZJc5jeo106s5ThhOM/Ol16oVMuSx69wSC6QgUZx1 UghUr9IpFmvDbsoNEIdBq+VGkBek8EqXHekmtkcQKx4RfeZWo8Yk9833E8mLKqUXR0pPxsACvUy UNF20iWTcd/fzieTfU38utIqm5FWBlzGIs6HwwCR4QeT19RQ 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130203_532607_D67185C4 X-CRM114-Status: GOOD ( 15.33 ) X-Spam-Score: -0.7 (/) 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/devices/bcm47xxsflash.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/devices/bcm47xxsflash.c b/drivers/mtd/devices/bcm47xxsflash.c index 3af50db8b21b..74f559bf8dfb 100644 --- a/drivers/mtd/devices/bcm47xxsflash.c +++ b/drivers/mtd/devices/bcm47xxsflash.c @@ -357,19 +357,17 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev) return 0; } -static int bcm47xxsflash_bcma_remove(struct platform_device *pdev) +static void bcm47xxsflash_bcma_remove(struct platform_device *pdev) { struct bcm47xxsflash *b47s = platform_get_drvdata(pdev); mtd_device_unregister(&b47s->mtd); iounmap(b47s->window); - - return 0; } static struct platform_driver bcma_sflash_driver = { .probe = bcm47xxsflash_bcma_probe, - .remove = bcm47xxsflash_bcma_remove, + .remove_new = bcm47xxsflash_bcma_remove, .driver = { .name = "bcma_sflash", }, From patchwork Sun Oct 8 20:01:27 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: 1844944 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=W9iEU+tw; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y430zfjz20Vh for ; Mon, 9 Oct 2023 07:02:42 +1100 (AEDT) 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=OjO13NHUZk+7k+LMlMkDZEEqaSjxtFP9LR4ayI3OtMk=; b=W9iEU+twwBV0jE W7L/Rbu0tg9mFUQhuOfsQOlqIRNvra4kzhjWpyZjOW5swS+qPKbjvfjDgo9lTachireg2Q6Jft3X7 kCANBWQb1L/aRKycCSzk18tcdrkmE52RkkTC0yXTW7xGKBSlKaSvNHZXxGj1ymUGyIwAKmDl1Htj6 TKfonOLQMM5GsC9lQjqrSql4bappY3Zbdj4ZpEUVxLCVQpo62hC/wrneK7aw1ej8M7yGIkVJ8L0gW 2zMeO+wJqvCbJ5qz5rmrg3ebOQlPCRusV62Lcb3aMHlipYRd2M44ayyCcgB2RY9xxbh4/dg/TQGRv 0Zhe8MoFLzs970um5DOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyd-009DxX-2B; Sun, 08 Oct 2023 20:02:11 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyV-009Dqg-1o for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:07 +0000 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 1qpZyM-0001SZ-Po; Sun, 08 Oct 2023 22:01:54 +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 1qpZyM-000EzL-9M; Sun, 08 Oct 2023 22:01:54 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyM-00Bf0B-0N; Sun, 08 Oct 2023 22:01:54 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Robert Jarzmik , linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 04/20] mtd: docg3: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:27 +0200 Message-Id: <20231008200143.196369-5-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1839; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=7VKHSbrgIeIZ8/rbG5ulAqJ+HY0yrpc1MHJBjhJf/Oc=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwp/mT4ONG8T92sUaiHOeJLjbl9td2DT8siY/ JuzF1ghTlyJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKfwAKCRCPgPtYfRL+ TiQjB/97FYINha0y30wOx+hoWd/0xEdiSn7jwG5EQ4Q+yT5Vf5oZIq2fCmAQpYjnxwn9W7hK8Vb owPlkJaZTlhSdS7vPRFavEXoVqJlxNZWou1ZO0DajplZJf/R8KpRTge4YrRYpsFSoRDUzGI5Vl+ l5QJE4G9+WD9t3GiHpk3zAhTD/7VyEzLjzLMi0yhdJACSMAZVVzjJaegLZ2K5qOO41TlCT0gZ8d m7VdNO8Bw8Z939HNPcyejIp3zGPKEMgiOErH0vpnF/N5MpB7F5/ufXQ0MXqexKZulrcIqoidTGj UcwipLBTTjBAnTFYoAbjzAviM1ccJ/eI2RRQyZOjndigbhoD 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130203_616604_A87FB518 X-CRM114-Status: GOOD ( 15.90 ) X-Spam-Score: -0.7 (/) 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/devices/docg3.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c index 22e73dd6118b..a2b643af7019 100644 --- a/drivers/mtd/devices/docg3.c +++ b/drivers/mtd/devices/docg3.c @@ -2046,7 +2046,7 @@ static int __init docg3_probe(struct platform_device *pdev) * * Returns 0 */ -static int docg3_release(struct platform_device *pdev) +static void docg3_release(struct platform_device *pdev) { struct docg3_cascade *cascade = platform_get_drvdata(pdev); struct docg3 *docg3 = cascade->floors[0]->priv; @@ -2058,7 +2058,6 @@ static int docg3_release(struct platform_device *pdev) doc_release_device(cascade->floors[floor]); bch_free(docg3->cascade->bch); - return 0; } #ifdef CONFIG_OF @@ -2076,7 +2075,7 @@ static struct platform_driver g3_driver = { }, .suspend = docg3_suspend, .resume = docg3_resume, - .remove = docg3_release, + .remove_new = docg3_release, }; module_platform_driver_probe(g3_driver, docg3_probe); From patchwork Sun Oct 8 20:01:28 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: 1844951 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=V8azIurt; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y485yKVz20cr for ; Mon, 9 Oct 2023 07:02:48 +1100 (AEDT) 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=Ymf19bJAoW0OP9/3OM2F+6w5cV6YSN+23soWnbU64xs=; b=V8azIurtE7M2tR HIH4HeUMo28I3ia4mcyWE5CnfVnLPf6GFuG5p+1pPBemrgHmUiv7ptQk+3A4+EEfFkb2ftaoEphzc wlwJgS3uK0hMjLh0AaS4Ou+4Z4NtnDmvyUZQvsIrMT6ROi6RV0bgSWHV+Vyxk1kIglNUedn0EJo7/ ESMHIdA2YHk9iTpYgpVYfoXiXSnI+ZeOUu+Y4kCud6TMO/DXLYgBEvSpE6LQxiPANpsbcIoibLcaF WONK0CZ+N8mo1GUttFwMLIT9NlwoDBerUp39e6v7gsG4sW2G6GYCkokMuKaIucoH+LB0Y0Pqp5keA kWC3vVrPIr3L+He89ZSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyg-009Dz4-0t; Sun, 08 Oct 2023 20:02:14 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyW-009DrE-27 for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:09 +0000 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 1qpZyN-0001Sk-4L; Sun, 08 Oct 2023 22:01:55 +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 1qpZyM-000EzP-Iv; Sun, 08 Oct 2023 22:01:54 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyM-00Bf0F-9a; Sun, 08 Oct 2023 22:01:54 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Joern Engel , linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 05/20] mtd: phram: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:28 +0200 Message-Id: <20231008200143.196369-6-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1655; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=qUq0uT8BS02+Q1TJZ61v0B12sQYNbP+xdTZs7JPHVKU=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwqB/xcP/JAiFP10u24ar5K6EylSwgJWfW7fg WVudZ9onPqJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKgQAKCRCPgPtYfRL+ Ti72B/9DzuTjlgzjp+IvhEFm2whOPIu+RLFGCZ3Mn+OeKrRwE/H2hKnT0fX9qyyPcvbAInREWSH j0W5cX86pJjYjL7SaCxWbFmzXtOZOGpn0JlGIhYu6BAK6Oof9cAu0YJeFqIAOXLk4KKubgnNQmP tIoy6rEzo/9uRDZOhc5PxYOFRqbeS507BZ0cNxE/DjmRUUsIO/JE5dtXb2cklShUFcMCkP6dtYF a4hvt8m1LE8L4Nw5FMieNoiA/VG7vrP3LfmjQyBkaXahW3h9LBSmuiXopSNM3L88UrR3X24rN/u PCAFJWU/XlBUE0JkFMyBOHnp588eSNSWmNKLNc74XsC9Tf2Q 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130204_687688_1A460ACC X-CRM114-Status: GOOD ( 15.71 ) X-Spam-Score: -0.7 (/) 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/devices/phram.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c index 208bd4d871f4..1bf192f229d7 100644 --- a/drivers/mtd/devices/phram.c +++ b/drivers/mtd/devices/phram.c @@ -388,20 +388,18 @@ static int phram_probe(struct platform_device *pdev) PAGE_SIZE); } -static int phram_remove(struct platform_device *pdev) +static void phram_remove(struct platform_device *pdev) { struct phram_mtd_list *phram = platform_get_drvdata(pdev); mtd_device_unregister(&phram->mtd); phram_unmap(phram); kfree(phram); - - return 0; } static struct platform_driver phram_driver = { .probe = phram_probe, - .remove = phram_remove, + .remove_new = phram_remove, .driver = { .name = "phram", .of_match_table = of_match_ptr(phram_of_match), From patchwork Sun Oct 8 20:01:29 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: 1844955 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=gPISgdWj; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y493pvrz26jT for ; Mon, 9 Oct 2023 07:02:49 +1100 (AEDT) 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=ByWwj8lhksOs5a5/1V6EBjgACoY25VETmdxnI9MH7mM=; b=gPISgdWjQIEp5+ nypmmqEDBDizvCupqdez8ndCV0e7aqsJwYI9QWs3pR8z9TJgvWCNarHDWUmAy+ztpbqgim6r381ar 6Od1cq/EQ6mdD+S9OhmE186Qj7zWU3rKkMEgQ1Mw9QJUVAWFRAiKSyzvWQgS+D6LvVMCEAPRs1+E6 +7b62S9JTiltomZRZlOresM1UEzIGH4GMFqOVjD5skfZb2NYxULiIMaPAi0r1KoKs9WQIK1ZfeYwO QGDpR82z/gC3wHexGZihlOT1smbKKPjxaRkYyZXp0uddeiNa55o48ctek/uZu+qlQNbOOiRIB4APr tWPnvVXP9Qbc6XEm/ccg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyi-009E0j-2t; Sun, 08 Oct 2023 20:02:16 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyY-009Due-14 for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:10 +0000 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 1qpZyP-0001V1-F3; Sun, 08 Oct 2023 22:01:57 +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 1qpZyN-000EzT-2t; Sun, 08 Oct 2023 22:01:55 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyM-00Bf0J-Pw; Sun, 08 Oct 2023 22:01:54 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Michael Ellerman , Nicholas Piggin , Christophe Leroy , linux-mtd@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, kernel@pengutronix.de Subject: [PATCH 06/20] mtd: powernv_flash: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:29 +0200 Message-Id: <20231008200143.196369-7-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1849; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=SNxKBQN3w7wXtWV2/V/mud+9ty25OkXgeLAIa2U5Vkg=; b=owGbwMvMwMXY3/A7olbonx/jabUkhlRlrmaVvTdZQ4QWv02eoLmfX/9QfcGSzOzGTQxljTYd0 5tUWZI6GY1ZGBi5GGTFFFnsG9dkWlXJRXau/XcZZhArE8gUBi5OAZhI8XT2//EVEjLSThUiW+dF 1Crlf3DUPLlz4uwmM4FFypEBmpapnvdvif4RV9eQYjze/r1e5cXfpzw8bxOu/5Qt/vnGry7Zy/K O+MXeR6FSSzr/lb1LO1v+sPH7i1KbXgujbxxLPxlM+Nb28fy5UMb7q8W41TeqJHqdLndS6VveGf G01//MdNErsQmnI2vvhRaLLH9vmvBTL8ndQmij9e7v2YIafeLdDK9tVyYumL/Zxevwq8ptGQ1vp VXmc1288c05K21N7FH3o7INGz5qzHbT29n8MzFz5pGkrYEvNoncPn9hxSKug2pP4p/V5T8/fMQk 2m5doZ6AulRqNPOrTLOvayeLHdTwb38/Wetm6GZ93vvKAA== 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130206_369791_861001EF X-CRM114-Status: GOOD ( 16.44 ) X-Spam-Score: -0.7 (/) 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/devices/powernv_flash.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/devices/powernv_flash.c b/drivers/mtd/devices/powernv_flash.c index 36e060386e59..66044f4f5bad 100644 --- a/drivers/mtd/devices/powernv_flash.c +++ b/drivers/mtd/devices/powernv_flash.c @@ -265,14 +265,12 @@ static int powernv_flash_probe(struct platform_device *pdev) * * Returns 0 */ -static int powernv_flash_release(struct platform_device *pdev) +static void powernv_flash_release(struct platform_device *pdev) { struct powernv_flash *data = dev_get_drvdata(&(pdev->dev)); /* All resources should be freed automatically */ WARN_ON(mtd_device_unregister(&data->mtd)); - - return 0; } static const struct of_device_id powernv_flash_match[] = { @@ -285,7 +283,7 @@ static struct platform_driver powernv_flash_driver = { .name = "powernv_flash", .of_match_table = powernv_flash_match, }, - .remove = powernv_flash_release, + .remove_new = powernv_flash_release, .probe = powernv_flash_probe, }; From patchwork Sun Oct 8 20:01:30 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: 1844954 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=gtqhApa2; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y490D47z26jS for ; Mon, 9 Oct 2023 07:02:49 +1100 (AEDT) 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=hyzABIvktEpt2uLJ9oNlImXBzRZoE3QqpNrpwRr0wC8=; b=gtqhApa2hZ0wrI p294l0lXYKBd7Af/uTQ9CwhEEIh/DDSwWrm0PwlhO79yDNrLjtOXMTPzCSiizVnJn5fiN7FdLPxAj YPyWfFXPjBeQuYMcnmRU67SDUdjuHuomk4Ald3CLGILL8cMOPaljmEcp9t7nkR+IFWiCpnIICXQNs 0CO2MyKsjhiwOPop0udwhT7QrZUmHEWujzMa7MtbEVjx8Qo4J19+RtTxtcg45lU6a0x8ImMaJLbZK z8qGV3a+qPDTFBfSwdeltSLltUlEo4uVXY9RN7ErZaIlHOxQQ/SPwH7UNs26hAxgc4wemacriXrMR 4Rtomj3uyGDp1k8dS5lQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyo-009E6S-0D; Sun, 08 Oct 2023 20:02:22 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyf-009Dxk-0G for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:15 +0000 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 1qpZyS-0001Vm-8f; Sun, 08 Oct 2023 22:02:00 +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 1qpZyN-000EzX-DD; Sun, 08 Oct 2023 22:01:55 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyN-00Bf0N-3r; Sun, 08 Oct 2023 22:01:55 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Yangtao Li , Rob Herring , Li Zetao , linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 07/20] mtd: spear_smi: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:30 +0200 Message-Id: <20231008200143.196369-8-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1858; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=sveKBkh01zR5KS97XnbSKPbBTsl/YD+UUG7a3fG4VZU=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwqF1bDojy9D+tsMwch1v0IT0itH1TNLhkKIe TI1IMoYyx6JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKhQAKCRCPgPtYfRL+ Tk1cCACY2uIaqRhvQdL84VCayD/lUDkMOvnNyj+Ua883bHxB8AN0LKaqs4fZwYtjPPC+dfV/YKY HX5CxMX6/XDputU1d9RUT1E52vCt/3PZ2/xPi3zEGxMwJK+nFi4FJZFW9TeS8WsVhz5XbuagbGH fMn3ZjP631QPiklHvjyUFDCDM5xDLnrfo/wfhF1DKCmi/uKu6MXlKLjMJV8ekUe6fEWvgY4AvJx 2I/I0raEGMGzYc1sTMtOPYbEJS9BRZdJoBrjJf9Q3mBDj+qx7ESj8oIoVJV3dvpu5wBCT25xKub Z0FV9+erZkV6G7Mz+Oo7orGF0zitlOJhJM65oojeRdU8Lyrd 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130213_118483_987DFB70 X-CRM114-Status: GOOD ( 15.77 ) X-Spam-Score: -0.7 (/) 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/devices/spear_smi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c index 0a35e5236ae5..1574296d47e2 100644 --- a/drivers/mtd/devices/spear_smi.c +++ b/drivers/mtd/devices/spear_smi.c @@ -1031,7 +1031,7 @@ static int spear_smi_probe(struct platform_device *pdev) * * free all allocations and delete the partitions. */ -static int spear_smi_remove(struct platform_device *pdev) +static void spear_smi_remove(struct platform_device *pdev) { struct spear_smi *dev; struct spear_snor_flash *flash; @@ -1048,8 +1048,6 @@ static int spear_smi_remove(struct platform_device *pdev) /* clean up mtd stuff */ WARN_ON(mtd_device_unregister(&flash->mtd)); } - - return 0; } #ifdef CONFIG_PM_SLEEP @@ -1095,7 +1093,7 @@ static struct platform_driver spear_smi_driver = { .pm = &spear_smi_pm_ops, }, .probe = spear_smi_probe, - .remove = spear_smi_remove, + .remove_new = spear_smi_remove, }; module_platform_driver(spear_smi_driver); From patchwork Sun Oct 8 20:01:31 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: 1844952 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=TN4xFSVK; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y486Nvvz23jL for ; Mon, 9 Oct 2023 07:02:48 +1100 (AEDT) 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=gcQSForEAZ/xgyIB2tU0wjOu4AR3ramZeG7m/4cfaJY=; b=TN4xFSVKzV5Y1g KbNgMmqGtlIaVBw3kyfDk5Bxron6hpe/F41S9UWljJVM3Nk20nw/sAs+1s7AcVXVa3GKypfqBOFwa hpiW3ESZBGYe0V9n5U7ZjOhyNA6vjOMAbY70S799buUFr2ENaVrP64oOSvAnNWnkrvhqZFL0hNjuw wZIWi4lBXFeKXotL4SrHl1hQ1o9bTVa4nK5rrxCQvTNxdDUkcgzM01oy99SGg85Wa9KkAbxJQX9Tr 97mgBSE1xpbWgX9JEmHRbzEZIRzeenBGtOTCLokohaSzL7NHy1cZg8fUS3KvXRJCBApwyA4F8rVEN HSdToQnQpT0ojqhh5IgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyf-009Dyg-29; Sun, 08 Oct 2023 20:02:13 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyW-009Dsx-2i for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:09 +0000 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 1qpZyP-0001Vx-F8; Sun, 08 Oct 2023 22:01:57 +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 1qpZyN-000Eza-Mr; Sun, 08 Oct 2023 22:01:55 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyN-00Bf0R-DR; Sun, 08 Oct 2023 22:01:55 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Yangtao Li , Christophe JAILLET , linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 08/20] mtd: st_spi_fsm: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:31 +0200 Message-Id: <20231008200143.196369-9-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1741; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=taKSLyrtiZ/aWfzzQN03pzzpl0OhZd0TTf8sHTQ4/Js=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwqH82SkTGuXuQdE6iky31HtMIyWjMxY6IJxk 4kZqaMSEQ2JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKhwAKCRCPgPtYfRL+ Ts9uB/96qyvsz7FFJW1wf/v+IxQVKs8hGB0NKFLvNldMo9Wji1GrQf2B7EV3BNRga+shXFYhq6d v6usFJ963fvVxv5HqusbML17J5/Y6qCJuwjvCa108X/J5ro26eTJ83N1KkVT5RDW1JIrLFCnhoQ SSwtFpUM+C5DTPAXY9gtFS2fLTjuiScUGBK6/W51wRD45oFGSN/twV6nOGGu1LlBhVfsEx3ISuM SB0h7zPDlOqZj1qorOrwy7W+Dpbf6uSgJzja3hqt2IfXyAq0sgNwFzzeHE/LDZHP8wNx8VZeMv9 4Zb5jpZztdwqKxpu1FCN2OwJjTtXzTQ4q6K+RXNCzb/U5LQ3 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130204_874535_E5D6D439 X-CRM114-Status: GOOD ( 15.65 ) X-Spam-Score: -0.7 (/) 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/devices/st_spi_fsm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 95530cbbb1e0..3268de5fc780 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -2097,13 +2097,11 @@ static int stfsm_probe(struct platform_device *pdev) return mtd_device_register(&fsm->mtd, NULL, 0); } -static int stfsm_remove(struct platform_device *pdev) +static void stfsm_remove(struct platform_device *pdev) { struct stfsm *fsm = platform_get_drvdata(pdev); WARN_ON(mtd_device_unregister(&fsm->mtd)); - - return 0; } #ifdef CONFIG_PM_SLEEP @@ -2134,7 +2132,7 @@ MODULE_DEVICE_TABLE(of, stfsm_match); static struct platform_driver stfsm_driver = { .probe = stfsm_probe, - .remove = stfsm_remove, + .remove_new = stfsm_remove, .driver = { .name = "st-spi-fsm", .of_match_table = stfsm_match, From patchwork Sun Oct 8 20:01:32 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: 1844953 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=GKVGwY4B; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y4873bSz26jR for ; Mon, 9 Oct 2023 07:02:48 +1100 (AEDT) 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=U0c1hDJTixlkKD4sLRonZWJxbwpYkAcbgbaO4C/WnCE=; b=GKVGwY4BcDcctB 5RRrc3vcoSKVsKw/T2qGtuioFSObkptxgs/8DBsPBVQuAIjtRqa5RRZscFD9CfhzROWflp52WH5YB WwKCDoPlBRJuEhmImsMcHfmSQPbKC6fp2DcFiSRIJhvtKFlinBXf3yVUmWYL/5I+CUCx7kmwBd7YO vftHaMsuLVOv4w3D65v6nnAZ3A6OG4EXF1/ffmJhOznne+UpJ0sAQEsrns7uYWOGQDqlae+mMx63L aYFUpaQuMWu2o46I6r7ltD5dMBY2UvooAuerW4r5jU4ktMyluWVPUUL6dywVr1zv8vh0jhiGOEfkf d3c5k9xF9hc+NWBtyGAA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZye-009Dxd-0l; Sun, 08 Oct 2023 20:02:12 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyV-009Dqx-1l for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:07 +0000 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 1qpZyO-0001WV-Cq; Sun, 08 Oct 2023 22:01:56 +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 1qpZyN-000Eze-W6; Sun, 08 Oct 2023 22:01:56 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyN-00Bf0V-Mp; Sun, 08 Oct 2023 22:01:55 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Vignesh Raghavendra , Miquel Raynal , Richard Weinberger Cc: Tudor Ambarus , linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 09/20] mtd: hyperbus: hbmc-am654: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:32 +0200 Message-Id: <20231008200143.196369-10-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1969; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=pV31gLoqZ68E2oVLdJb8rCj+euAV5krzg3MxI/Yxojk=; b=owGbwMvMwMXY3/A7olbonx/jabUkhlRlrs65v9YekChviTIp1DgnJDFLRjLt/0Z/I9Vri+oEl vqdCZ3VyWjMwsDIxSArpshi37gm06pKLrJz7b/LMINYmUCmMHBxCsBEpO9zMCyclhx+3Y/pdt6y mwI9hivtWJI+uYasYwjtiHy9sbg6+cSUtz8cnMvtN7z//9cnS13t8/mMENnYe64fc3YtuHH5pFp c3mpGTc+ZrM4TgxusMmbG7r2//vyls3sKbJ8KSwmEW/GcTBHxDWd/9Ta+1LJuQ3lOb+jdW+zOxS /s/3bnzdHfFpJbu+2a+5pJcQ+SbraXLv+g5mAQdczP92Ttg4rdnpnffc9t/n7lBEvQJTmvAOVpK b7nV3gcMNdg3CK526p1HWPb8x8911xO1G59zH/OV2Xle1PbaZ6vXxa7Nu1VN9poZ+4o1LZVI9ow RkBdsF01tGfay1saCwL7lyjdZNM/58w16/PuEEFtrZeGAA== 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130203_600823_6F4BE566 X-CRM114-Status: GOOD ( 16.17 ) X-Spam-Score: -0.7 (/) 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/hyperbus/hbmc-am654.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/hyperbus/hbmc-am654.c b/drivers/mtd/hyperbus/hbmc-am654.c index a6161ce340d4..dbe3eb361cca 100644 --- a/drivers/mtd/hyperbus/hbmc-am654.c +++ b/drivers/mtd/hyperbus/hbmc-am654.c @@ -229,7 +229,7 @@ static int am654_hbmc_probe(struct platform_device *pdev) return ret; } -static int am654_hbmc_remove(struct platform_device *pdev) +static void am654_hbmc_remove(struct platform_device *pdev) { struct am654_hbmc_priv *priv = platform_get_drvdata(pdev); struct am654_hbmc_device_priv *dev_priv = priv->hbdev.priv; @@ -241,8 +241,6 @@ static int am654_hbmc_remove(struct platform_device *pdev) if (dev_priv->rx_chan) dma_release_channel(dev_priv->rx_chan); - - return 0; } static const struct of_device_id am654_hbmc_dt_ids[] = { @@ -256,7 +254,7 @@ MODULE_DEVICE_TABLE(of, am654_hbmc_dt_ids); static struct platform_driver am654_hbmc_platform_driver = { .probe = am654_hbmc_probe, - .remove = am654_hbmc_remove, + .remove_new = am654_hbmc_remove, .driver = { .name = "hbmc-am654", .of_match_table = am654_hbmc_dt_ids, From patchwork Sun Oct 8 20:01:33 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: 1844943 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=xAzzRvGN; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y426PNRz1yqP for ; Mon, 9 Oct 2023 07:02:42 +1100 (AEDT) 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=71HKbGGGrdajnDRk0HQoNXe8SvakTkA6sfKnWVPJrys=; b=xAzzRvGNh8AwN1 6/9nGJHj21Z8o85vs/7fooAnio5CHY+Cr1e0AK64cP3XRksf4xecEJUErh8dn++F17EnDjQnsMZZV 3wR/OEHoBA4Zislg+LsdMtZtGiSldOwYc7+yVArltEsjDhVSSZvnZ4Uk2hJDygDJwNRq3aEfZu84B cwlErhbfCSDjGt/0yN+QU7F7kGDEo3V43KuF3tek6J99V1FnJoUSNR5Tc2nbq+Beg9+ZdzItPaHr0 QTeyCHPvtAKne9XiJkr9S+2Yl/EwayzoQ5X6/k+x93Dgm4tRFg27Z9cVbFMQlzYFsgeJeH5to36eU jZG0ULd/bHcccOqXglZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZya-009Dvr-1u; Sun, 08 Oct 2023 20:02:08 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyV-009Dqw-1i for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:07 +0000 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 1qpZyO-0001YM-MJ; Sun, 08 Oct 2023 22:01:56 +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 1qpZyO-000Ezh-9S; Sun, 08 Oct 2023 22:01:56 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyO-00Bf0e-0A; Sun, 08 Oct 2023 22:01:56 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Vignesh Raghavendra , Miquel Raynal , Richard Weinberger Cc: Tudor Ambarus , linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 10/20] mtd: hyperbus: rpc-if: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:33 +0200 Message-Id: <20231008200143.196369-11-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1665; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=7eQAR1pKoC9wnZ0mAaAcNt0WH40d+IlL6s8XiGrzxGw=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwqLCck0qHa0kcxvTVIlWFZMQAs3ThPd9JeBi JIArXL576iJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKiwAKCRCPgPtYfRL+ Ti+jB/9cgSXif3CNQQIbBfjyvTp5olwGYbyH8Y1w71z7L2tndi+GTnf/tiinf7KmYD9X6903sVc 7wUuzr0+r51DnSEwSM0JCwz+9AzPJ5ImUdWSYB2PfCu1Y+P8UIXrFG4iz+pkAV3UaKaTntbkI03 FE161wTLAHspBY6+rs64KQqTZA2RDTBTCvGBEH9ja7HbuHf6C0ehU9Uw8Oon+Lf8X/9j4tgOH/g ESAuHJZyrsu/3Vl4gL7frtKtcLUKv0b+w2TAQHMaKEosAGRFu2dWrNCmg1pD208MU+O0PLkJHZB j7m86zU4LHiT08x1bdeLhI6b42LmXRnkQp2mHNcC/QkoTlhm 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130203_579643_46B974FE X-CRM114-Status: GOOD ( 15.33 ) X-Spam-Score: -0.7 (/) 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/hyperbus/rpc-if.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/hyperbus/rpc-if.c b/drivers/mtd/hyperbus/rpc-if.c index ef32fca5f785..b22aa57119f2 100644 --- a/drivers/mtd/hyperbus/rpc-if.c +++ b/drivers/mtd/hyperbus/rpc-if.c @@ -154,20 +154,18 @@ static int rpcif_hb_probe(struct platform_device *pdev) return error; } -static int rpcif_hb_remove(struct platform_device *pdev) +static void rpcif_hb_remove(struct platform_device *pdev) { struct rpcif_hyperbus *hyperbus = platform_get_drvdata(pdev); hyperbus_unregister_device(&hyperbus->hbdev); pm_runtime_disable(hyperbus->rpc.dev); - - return 0; } static struct platform_driver rpcif_platform_driver = { .probe = rpcif_hb_probe, - .remove = rpcif_hb_remove, + .remove_new = rpcif_hb_remove, .driver = { .name = "rpc-if-hyperflash", }, From patchwork Sun Oct 8 20:01:34 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: 1844949 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=4oev5sTw; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y482PsWz1yqP for ; Mon, 9 Oct 2023 07:02:48 +1100 (AEDT) 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=0lwqnSal5JcTSVHQ2BwOS7UHzI7l81AJyrUCS6KLuW0=; b=4oev5sTwSJWOsf C9iIzV+Qm/sqK7xhplsFYf2f/d/rI+hwFp+8LYME62ysa3qF2MnpQgwULSf3UWSrn5JaXry2gZlfk yiFTygf9TTafVO0uV3CBObd/TOQrLjBtiZUvZ6lYgB6DAMux1YlNV4KUWH+CMc48X9yY+aUSFhr3o T0x+RGWEBzivutBgDqh96BVm7/Yez+CfzwCEuJQPScQrAFi+c7kETHCwyFG0gQU2U3IqUyhEl+QMc V2IDvXf/CudcLjDKW0D4QvSOudgdm/q0gqbU+OL6GUPkExL9jq1iB1wPIGJc6zg/Xf0k384GSjARs je+P/X+TMt9FCeJ4EziA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyk-009E25-0h; Sun, 08 Oct 2023 20:02:18 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZya-009Dvd-1S for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:10 +0000 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 1qpZyS-0001Yc-9K; Sun, 08 Oct 2023 22:02:00 +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 1qpZyO-000Ezl-Ho; Sun, 08 Oct 2023 22:01:56 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyO-00Bf0i-8h; Sun, 08 Oct 2023 22:01:56 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Hui Tang , Yangtao Li , linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 11/20] mtd: lpddr2_nvm: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:34 +0200 Message-Id: <20231008200143.196369-12-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1714; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=F3MBL0A1oTKO24UwFt5q+Qq30ydMO5UmafloJWvAdDc=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwqNwRYEn+6b+vUQ2tU8TVROQfxyTBxAYhcki Ccb2JMZZNmJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKjQAKCRCPgPtYfRL+ TkR7B/0ZLDfyog65rf3mRaKfFuvbGiqWX6JO41YJ3n+jkw7rr4zyQdxCXI8J2DAosJEkXpLmciZ FL95aQvqwhamis0Fiy3VAdMGxTiu1JI5fjCzYFhr06JiYhMeDwWJCogW+C2KpwS7X9lkVVuL8gE +XkvC9PuYaPn1LHoVJMLzGzLiCEcNdQeg2RWPrXrydT1rCotcVmj/+h8QwwA9a/fDrTQhrwaj6O CfP0/NwLPYmPTL2zjpZEZZb45OD4aEgaFvx9ePPjHRha0zg4wYr+su0ooUVB+S3HoEIKWuo3hGx ZK4+go6SLqaW5kX8Nw1IZrC0dILnoCEJW/lSYTH7t6JCsuhZ 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130208_524722_8E4267CC X-CRM114-Status: GOOD ( 15.48 ) X-Spam-Score: -0.7 (/) 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/lpddr/lpddr2_nvm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/lpddr/lpddr2_nvm.c b/drivers/mtd/lpddr/lpddr2_nvm.c index f4e5174b2449..9169e1155dbb 100644 --- a/drivers/mtd/lpddr/lpddr2_nvm.c +++ b/drivers/mtd/lpddr/lpddr2_nvm.c @@ -476,11 +476,9 @@ static int lpddr2_nvm_probe(struct platform_device *pdev) /* * lpddr2_nvm driver remove method */ -static int lpddr2_nvm_remove(struct platform_device *pdev) +static void lpddr2_nvm_remove(struct platform_device *pdev) { WARN_ON(mtd_device_unregister(dev_get_drvdata(&pdev->dev))); - - return 0; } /* Initialize platform_driver data structure for lpddr2_nvm */ @@ -489,7 +487,7 @@ static struct platform_driver lpddr2_nvm_drv = { .name = "lpddr2_nvm", }, .probe = lpddr2_nvm_probe, - .remove = lpddr2_nvm_remove, + .remove_new = lpddr2_nvm_remove, }; module_platform_driver(lpddr2_nvm_drv); From patchwork Sun Oct 8 20:01:35 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: 1844957 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=BrZGdh97; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y4B0k7fz26jV for ; Mon, 9 Oct 2023 07:02:49 +1100 (AEDT) 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=zTO0moo5ES1B76HdL9txZA/r7qa3nOQstfPNqtTHp9E=; b=BrZGdh97jY5wPA Fiw+xL32012vbIylsFVEa67YSelCWV+hhMJtsXvvV8l0Ja66vjNzItznbF5FGrFUFa2SYq1/CObxL QDN4tUmkDATx3WqF7fWaA0/SyLifcl36B2tyHwlAy2GGH/dByT/BGXRtOLofxCKYizEheVyHs/Gq8 2entxU2b1M0fBftPIoRm3cgKFVRTaQ5zfgI9FbSEfXbl4gqnnBE7kz6HfAv5K6ssb2EFgidb+AMYv 9OgXm/RnbZNmD1Ckl441Eu9fom2C1ZdmaC2wf415FyuEHwQ8KzTAE3SLSD0uxaUeT2AqrFoLpccxK FKucXZpktpwV/J+oCLKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyk-009E2k-37; Sun, 08 Oct 2023 20:02:18 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyW-009Dsy-2x for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:10 +0000 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 1qpZyP-0001ZN-Bd; Sun, 08 Oct 2023 22:01:57 +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 1qpZyO-000Ezp-Rx; Sun, 08 Oct 2023 22:01:56 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyO-00Bf0m-Ii; Sun, 08 Oct 2023 22:01:56 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Yangtao Li , linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 12/20] mtd: maps: lantiq-flash: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:35 +0200 Message-Id: <20231008200143.196369-13-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1827; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=ICxCmviUbnnaPTLbgfBlAHgRRe3igcPd5duF7qsvL60=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwqPQmBlh7wu5rhdNXUovP3EptxI1ATLtV4vO mNcpq5lAPWJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKjwAKCRCPgPtYfRL+ Tp2aB/41WQsZAZI36b2QAZuQUjyg79SiP491sapTHCs4YpFp5Pc6ooP+CacVYaCuN0iJXdy9LyP Ms0PMSe9vk+NsgBE+hbA7vxo4B9YxSccu6cvLpKQ6kiR8UAfYbqgw4bM6w4tjn6SXLKyoY7u8io JKnqDR4BTQFbkUIUDPIrs7U+D+FrtK7kq7nHGMGHiWa/nDqbs0WhVOjpJBk2FyYVK4R6B4xvFNB bWzlV87QXY58ROOqjfoanECueMQwuGUe6dzmPWz/bki9Clan8dGv72/05fZP+syXg8G/54gXUCN Hf7nPDUTKRdircywBI2UQCvwgDUDTBnVY/3AVWUHHbHJtpih 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130204_950642_B65A7E54 X-CRM114-Status: GOOD ( 15.17 ) X-Spam-Score: -0.7 (/) 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/maps/lantiq-flash.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c index a1da1c8973c0..124b13c5d747 100644 --- a/drivers/mtd/maps/lantiq-flash.c +++ b/drivers/mtd/maps/lantiq-flash.c @@ -166,8 +166,7 @@ ltq_mtd_probe(struct platform_device *pdev) return err; } -static int -ltq_mtd_remove(struct platform_device *pdev) +static void ltq_mtd_remove(struct platform_device *pdev) { struct ltq_mtd *ltq_mtd = platform_get_drvdata(pdev); @@ -175,7 +174,6 @@ ltq_mtd_remove(struct platform_device *pdev) mtd_device_unregister(ltq_mtd->mtd); map_destroy(ltq_mtd->mtd); } - return 0; } static const struct of_device_id ltq_mtd_match[] = { @@ -186,7 +184,7 @@ MODULE_DEVICE_TABLE(of, ltq_mtd_match); static struct platform_driver ltq_mtd_driver = { .probe = ltq_mtd_probe, - .remove = ltq_mtd_remove, + .remove_new = ltq_mtd_remove, .driver = { .name = "ltq-nor", .of_match_table = ltq_mtd_match, From patchwork Sun Oct 8 20:01:36 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: 1844960 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=sNkarmyr; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=mSb2Czjo; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y4H51MJz1yqP for ; Mon, 9 Oct 2023 07:02:55 +1100 (AEDT) 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=xF0yz52ElJV00UFYRSBS9PLLbLQd1k/OtHnKm5olfDA=; b=sNkarmyrp6LzeN MrnyzX1Zy4hnrTsIe8BEATszgVKsDRm6izLKGPHoKeVvXYqVDD+1x2tyPeFaaqV1upPw9gOkQjjFP ihnYNTUAXIMqiGWSl4+vjqJ5SChqyw8nlIXK3Y2dALQzyinxL3B6nrczPddjV0EuWADYBNecYQ5n1 C0GUccTfs5dXX38Sqrg6fhezyG18NZZRxp0WZB2dNVY+bs3nll81dRrMHdlJgV2BvSjXcRPzlI1gn tnbQVbVYOHKZdYUZiqCBmw0AV1RMfP0CA3dbYjO9MlD2NmVdwkBCLiwHrJTgyuhbw6hgLF+Yw3Lly aZala9+Pirh+iFlyO68Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyt-009ECI-0T; Sun, 08 Oct 2023 20:02:27 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyq-009E8X-2Z for linux-mtd@bombadil.infradead.org; Sun, 08 Oct 2023 20:02:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=4mTuqr2LKIU4Uy8BJH+p5wmw6vu4uehOeJbsorgEYz8=; b=mSb2Czjo6Jf2OlQ+zR0BFQOIC4 8QWTUuIQuLw3khhb/Gd04X+8O49Oz+OTPs284/2MwYweTGQwABEFEYoOe67zYLSAuyyMlVnn9W84e m8gffncqhek2qvPtQmT5EpfNSZO1ssMtcSFq98ymanKuzvpUKoGAnqKr4kO7b63QoEjYd4OHfr5Cl GLAVn5Xn48Ms/lSxC0lsQHW/MjvzChRlHQ20Sf6jIuUxj/ermXdwbxTE11Si6hNZUjedznx3QCzHE GVTRzr3odU64IJ20sxbqwp8ti4WshRaRwKhJev9eAVGz57a6UcVTrk2OBsJqDVaQAcLu3H/kIlUaX eQ9PSRrA==; Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyd-00ExWI-1G for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:22 +0000 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 1qpZyQ-0001cf-5I; Sun, 08 Oct 2023 22:01:58 +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 1qpZyP-000Ezs-5E; Sun, 08 Oct 2023 22:01:57 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyO-00Bf0q-SB; Sun, 08 Oct 2023 22:01:56 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Yangtao Li , linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 13/20] mtd: maps: physmap-core: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:36 +0200 Message-Id: <20231008200143.196369-14-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1921; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=u8yBoMcdGGgUA+k3FnrD7sJDTk865MYT3ug3juJaXu0=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwqRDP8W42K6l8I2UQTMtr2DkV47tTDcM4zR6 lZm2GvObNeJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKkQAKCRCPgPtYfRL+ TtASCACuBL3AHH2MVIFOgfVByMLXbXToBnMx3yKG6fuXrWdypKdLmrGkhYxW/269Q8NcBpFBrjf pIHwGQ97ENYofcSmAD5OwFbf4n7AbMtGYWm0bWIG6thk5Pjb9qq7pFOCHRUQVCnoRphLEWDNCgY WLtd0dOs0BORNA7CKUzzN5kf7DEX9+0GC6gH/CPc7cMmP9udnWA9iBlOWJtJRvJNx14vg0jNnEQ PF2EgOpEAc2kRcQU2Z4/hJhWdid/FRZbQqGK0WbEFUrOeCHh5OhCMLi4I9XqP7FvKHHkxb215T3 IjN55+qVUiJPoFgyCgQVUjAaiGu9h8Kkpz3aB014Qpbow6ee 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_210214_645378_1E875EF2 X-CRM114-Status: GOOD ( 16.43 ) X-Spam-Score: -0.7 (/) X-Spam-Report: Spam detection software, running on the system "desiato.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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/maps/physmap-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/maps/physmap-core.c b/drivers/mtd/maps/physmap-core.c index 78710fbc8e7f..b906a6d5369b 100644 --- a/drivers/mtd/maps/physmap-core.c +++ b/drivers/mtd/maps/physmap-core.c @@ -62,7 +62,7 @@ struct physmap_flash_info { unsigned int win_order; }; -static int physmap_flash_remove(struct platform_device *dev) +static void physmap_flash_remove(struct platform_device *dev) { struct physmap_flash_info *info; struct physmap_flash_data *physmap_data; @@ -88,7 +88,6 @@ static int physmap_flash_remove(struct platform_device *dev) pm_runtime_put(&dev->dev); pm_runtime_disable(&dev->dev); - return 0; } static void physmap_set_vpp(struct map_info *map, int state) @@ -615,7 +614,7 @@ static void physmap_flash_shutdown(struct platform_device *dev) static struct platform_driver physmap_flash_driver = { .probe = physmap_flash_probe, - .remove = physmap_flash_remove, + .remove_new = physmap_flash_remove, .shutdown = physmap_flash_shutdown, .driver = { .name = "physmap-flash", From patchwork Sun Oct 8 20:01:37 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: 1844945 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=FX3Hwzrq; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y433psVz23jL for ; Mon, 9 Oct 2023 07:02:43 +1100 (AEDT) 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=bYlhWfWLSAu7WB/vmL6kzBl6KUBdvPUbuQyb0EFcpaE=; b=FX3Hwzrq8R36ly HcQ8hXN6cTJ7zej2I2OjonAsLPCHtItcmnKFf75hJ5dUrIwi88xqo5wNRlffZ85tS9scsKothJVSP vgYINeLW13sTeBukJP0goNMQtuFLcuE/YPkBAKE1loinEHXEwPvfkKSI712BwaYZ5DEl0kfkbuZoh w65G74RVu5T3tugOlWPOTFgchDrcBKC6nOqmE/5eFJgxw2yUOiS6JwNgEhpsGpHnszQLt2/yusPMm OS1yiUSczqbptsu3RXGbgliAQLaa0zjdU3F30MbHZuIECnYqNyJ9NF83W2C5y6r4vySNw2SwVklqB XveAMaLb2IYiMO6Gjaug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyi-009E08-0q; Sun, 08 Oct 2023 20:02:16 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyW-009Dsm-1x for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:09 +0000 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 1qpZyQ-0001e7-Ao; Sun, 08 Oct 2023 22:01:58 +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 1qpZyP-000Ezv-Ey; Sun, 08 Oct 2023 22:01:57 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyP-00Bf0u-5i; Sun, 08 Oct 2023 22:01:57 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Yangtao Li , linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 14/20] mtd: maps: plat-ram: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:37 +0200 Message-Id: <20231008200143.196369-15-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1949; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=HqgY375rY6njHZqGPztbx5eLpqh95n5fI2juJ0Tb2ig=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwqTVea3VaqV8HToVjjyezfOW3x45BfyZMvim TVoaGPp84iJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKkwAKCRCPgPtYfRL+ TgdEB/sG7i1NGIH6FbDdP6HQdrs0OYwSTdKq4y7goM8+cm9sZo7vg/0X4T8Nn7GjMUhoHVFXSre SE25JuB+oYuQdt5RHgnDEaG5y+R2bf/7aRzhYlyGNrhBvi9PCW8p/54R9itk9mF8eq1SthqATYI gzhPW9Hdsrf//oW+GncF9wlVkxVD8qKhGnCLedndEv3VKIsKDNLgGvECqEavWGRKzoEevdgRTPh qMyCVda1g2AH9TN8ncVqi56u0A0yET9fldirbQOa9ExqkpHRgyaC/fJTS7996KkWeimcnS2W+sL En0NZyjvz+fcKI1D0ymwGkKY0jr6f+eQt5EdCu2r66xkycT9 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130204_638770_A4EC3B0B X-CRM114-Status: GOOD ( 17.46 ) X-Spam-Score: -0.7 (/) 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/maps/plat-ram.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c index 4c921dce7396..8b736f029f81 100644 --- a/drivers/mtd/maps/plat-ram.c +++ b/drivers/mtd/maps/plat-ram.c @@ -65,14 +65,14 @@ static inline void platram_setrw(struct platram_info *info, int to) * called to remove the device from the driver's control */ -static int platram_remove(struct platform_device *pdev) +static void platram_remove(struct platform_device *pdev) { struct platram_info *info = to_platram_info(pdev); dev_dbg(&pdev->dev, "removing device\n"); if (info == NULL) - return 0; + return; if (info->mtd) { mtd_device_unregister(info->mtd); @@ -84,8 +84,6 @@ static int platram_remove(struct platform_device *pdev) platram_setrw(info, PLATRAM_RO); kfree(info); - - return 0; } /* platram_probe @@ -207,7 +205,7 @@ MODULE_ALIAS("platform:mtd-ram"); static struct platform_driver platram_driver = { .probe = platram_probe, - .remove = platram_remove, + .remove_new = platram_remove, .driver = { .name = "mtd-ram", }, From patchwork Sun Oct 8 20:01:38 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: 1844947 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=AylywMJo; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y44265Gz26jR for ; Mon, 9 Oct 2023 07:02:44 +1100 (AEDT) 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=Nz5lYXBjZpOK+uJDjAUlPaxgS3nZMp9JvgckJc93/FM=; b=AylywMJodjCaNl dBZKfZbV3vIFJiGhsyXXf9yPlArUAAE/dSNYvNjxmM3hvWXBnIRLprqSgnhzoyUJRtaW9wbYX2uXO 4CaGDLQzqRq4VricVWzR+6SgXpnNwsaFsLy7yo/gLVP5hQL/qAmhapaN/JVAdYQMxzh2rz0snWKAw CFFY2vOW9q0uMrgyd2HkPEFLGcbVoclXgqJzN+N2X8n3AJwf/IJx0aHl3GKSSpX4iLut7T2uEfj2U NRcWHG4WqgOaFDuaXT5TynOZNzHYNITVC9wMly/kC57B/6Ym1yxGdqrMTTRYR6ePpahxSRm9pkfU0 borV2Zz2H3xjtwjjcmsg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyc-009Dwv-0s; Sun, 08 Oct 2023 20:02:10 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyV-009DrN-1t for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:07 +0000 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 1qpZyS-0001eu-8h; Sun, 08 Oct 2023 22:02:00 +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 1qpZyP-000F01-NM; Sun, 08 Oct 2023 22:01:57 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyP-00Bf0y-EG; Sun, 08 Oct 2023 22:01:57 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Zheng Yongjun , linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 15/20] mtd: maps: pxa2xx-flash: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:38 +0200 Message-Id: <20231008200143.196369-16-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1807; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=eRilE9x01rJ/vVmv3NJKguLvFFI+I6Q8n+Tm/X4Ui7c=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwqVJETia3TYDyK5d12bMhAanmbcw1lC5v7Nf NY4eUhXsrCJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKlQAKCRCPgPtYfRL+ TjowB/47vZnes3tlLrfLLjQg9jxgLsMxMdoI/1A59eCny/vo7sWAT6sIuivdBN5+Zqt/+Ps/O37 b9+vMA0rfFRAovADEsZsfia+YsYxWRE2EZ6rORYKP8JpNHByxHURBGkRZ2X/2d2buTOBYfwwoUs Cbs3g1+LSEgVbAf8IIo5mi21AWrNqZDHKhBw7D46M+8tHqjGmmx7+aT4ccEDURYwKgxOia83YzQ CuOkMJKCx6q4FZlMiU9dlvg4Dj4Tw5J8cpLNrRRN4Vqf525GJrUsDMbANrbQuuby6lT5JuJ6BrJ lQQM2KYNqi6Z8h15VMnT518bfSvPmsb5yEAJBLHCVs7oEydp 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130203_652249_9FB7EE4F X-CRM114-Status: GOOD ( 15.93 ) X-Spam-Score: -0.7 (/) 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/maps/pxa2xx-flash.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c index 62a5bf41a6d7..f2a2d4706f1f 100644 --- a/drivers/mtd/maps/pxa2xx-flash.c +++ b/drivers/mtd/maps/pxa2xx-flash.c @@ -98,7 +98,7 @@ static int pxa2xx_flash_probe(struct platform_device *pdev) return 0; } -static int pxa2xx_flash_remove(struct platform_device *dev) +static void pxa2xx_flash_remove(struct platform_device *dev) { struct pxa2xx_flash_info *info = platform_get_drvdata(dev); @@ -109,7 +109,6 @@ static int pxa2xx_flash_remove(struct platform_device *dev) if (info->map.cached) iounmap(info->map.cached); kfree(info); - return 0; } #ifdef CONFIG_PM @@ -129,7 +128,7 @@ static struct platform_driver pxa2xx_flash_driver = { .name = "pxa2xx-flash", }, .probe = pxa2xx_flash_probe, - .remove = pxa2xx_flash_remove, + .remove_new = pxa2xx_flash_remove, .shutdown = pxa2xx_flash_shutdown, }; From patchwork Sun Oct 8 20:01:39 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: 1844967 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=ttDMWCg5; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Zh60D24z1yq1 for ; Mon, 9 Oct 2023 08:15:31 +1100 (AEDT) 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=jq/NxGcDi00hMoz88nb5CdqczvkEdzEhti8fT/XAzgo=; b=ttDMWCg5QHGLRM 7XPC2q5laR1p3ZrZcBejS5/xDSTuqWBTAOHBjdgUY43fQ+ByAD4JMQjg5wd9PAiaY4vSfa84Om2du l6ZdQ0gubagQa6/gplDldg6HeQ6bkbF01TRJ/Scg3DX97hJH0HYMgQHU3PJWBLVYbUQ99KCgh1+pL fw1TX0ZzpRc3FH/ujVZqpYdMxp6/aJxRE8xQPhQc8b9FSQxQ1EUxHwJ5YlMKhKXUPCCMlCrIJmaQG 3Jj/3X8anLTRJfDJPAxJUNC6IOotC11ZBSY+nY9R0DttLWo1rA8yehh7JObX0m64Pmq4yhsenuWBG 9DoS0qXgLx0BaMNwLAgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpb7J-009KQQ-1b; Sun, 08 Oct 2023 21:15:13 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyV-009Dr8-1j for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:05 +0000 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 1qpZyQ-0001fL-NE; Sun, 08 Oct 2023 22:01:58 +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 1qpZyQ-000F04-0o; Sun, 08 Oct 2023 22:01:58 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyP-00Bf12-Ns; Sun, 08 Oct 2023 22:01:57 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 16/20] mtd: maps: sa1100-flash: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:39 +0200 Message-Id: <20231008200143.196369-17-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1671; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=uf6W0XKMxuxlUAp0ZDzQGVZV6bI0xycwJxENXjOhc5w=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwqXuEzeII/8FQ/7kEZ+B4MZap0THNGXqk77s JWPDIDrNuOJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKlwAKCRCPgPtYfRL+ TkYnCACsAiLHJ7qRYLCJ1sfjrseaqxHK42Ayon4j1qmz7t4X9G1KLB/xErjLMAYND3kPH8cNfcZ f+AP6floPEWHX1RVMspGadlZSC9Pfo0OY8WVOp1GsyxRFTamaXaSJr4SOHzzG4iNzJMPyw7U9ii A/DClf35CKr/akeJZtjaqYf40DoYraU7AQ9VIQzImdrBd+U31cOJYddUY+dcRpzsKSZ6HE0Vz8t C8Hp1NyQTEQHYY18MB6g8FWCVKWK/X7V9VMpHIrulz9PEsiJT7g6QXd1rVa+kaqSJ8AMmpmssSo Q8DzEXnExdnzyi2QchBb3LmorZzYu9sb3tWhpgC10C23uZ8A 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130203_573625_FC7F6DA0 X-CRM114-Status: GOOD ( 15.52 ) X-Spam-Score: -0.7 (/) 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/maps/sa1100-flash.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index d3d4e987c163..d4ce2376d33f 100644 --- a/drivers/mtd/maps/sa1100-flash.c +++ b/drivers/mtd/maps/sa1100-flash.c @@ -285,19 +285,17 @@ static int sa1100_mtd_probe(struct platform_device *pdev) return err; } -static int sa1100_mtd_remove(struct platform_device *pdev) +static void sa1100_mtd_remove(struct platform_device *pdev) { struct sa_info *info = platform_get_drvdata(pdev); struct flash_platform_data *plat = dev_get_platdata(&pdev->dev); sa1100_destroy(info, plat); - - return 0; } static struct platform_driver sa1100_mtd_driver = { .probe = sa1100_mtd_probe, - .remove = sa1100_mtd_remove, + .remove_new = sa1100_mtd_remove, .driver = { .name = "sa1100-mtd", }, From patchwork Sun Oct 8 20:01:40 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: 1844948 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=AvAsKEBd; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y4626fHz1yqP for ; Mon, 9 Oct 2023 07:02:46 +1100 (AEDT) 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=Vpf8sAYKzUxLEF+w9o7LSM1zny80U9hx5+OiAQuzS5w=; b=AvAsKEBdbOlvfG T8NjkeHHe39S+aXlXJoN3+QgyY+vHTETBW59GcjX3x/HauPAW7ixhXQclcS7JVBegKcj3AUEJk3Nx iT84JGBzWIgsbvXGEIyeLIwH8kdIaVDBzoHZBmqstIRPDm2pGv6pRlKoYD3nFpdga7TNTS+vK/KXa CF8ULO5ThBmaucvwIE0rO1p/YPAnFirYxqQ9xJ6e8r/qgIBDT2z2IoK88t33+kuBikAu0BF6XCgJh F8soCbD1JQVP4CL/DtDQeLj0BKYBDS3kSKwT+ygupU31c85xc6n/JYTPViLHEk3C7I48Z3Odmp/Uf 3qq3P8XC1+l0RH8d4Gbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyj-009E1G-1c; Sun, 08 Oct 2023 20:02:17 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyZ-009Duw-1R for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:10 +0000 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 1qpZyR-0001gH-6q; Sun, 08 Oct 2023 22:01:59 +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 1qpZyQ-000F08-Ag; Sun, 08 Oct 2023 22:01:58 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyQ-00Bf16-1P; Sun, 08 Oct 2023 22:01:58 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Rob Herring , Heiko Stuebner , Linus Walleij , linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 17/20] mtd: maps: sun_uflash: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:40 +0200 Message-Id: <20231008200143.196369-18-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1757; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=DPyP3SnLNcsZNdWXZbt3h9LX0tEZknP8RuOgrkv9eTU=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwqZRMIqBx3ioAidJW7LG0ktTpOC5OqUqMX1R ksEuMXdeECJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKmQAKCRCPgPtYfRL+ TituCACVXleKC5Tvyy4V53wmVmwAZMIuoNjzJfNmqhMIiz1SjiITzOA+C/7YmJ+UX6Ect622/tX n0LF+chEQuHH30Z0JpdbVqbGd1cyNEPlG9uQafCzi1XcBEJZ/t8O0tK6eZR7mV8Q491MpAElzAC vR8+H+60LsXhPXPrII8X6tfDYhmvfDGDtEt1P8vZVHlnnebq76Mi+WilVPuus4eDeQgVT6ce65w e0S2eXIxe+a+KOvPDMs/UADqkhqcLO4MyVZ3Oc3Gq5T3lY8BZOvATrKNsyi+Lf8UI3cuhyYqsG6 MezALNzhJFJ4NzASMnnC44sQ0J7M9f2AseVuEdvI8VSII6d4 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130207_514278_8127DACB X-CRM114-Status: GOOD ( 15.87 ) X-Spam-Score: -0.7 (/) 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/maps/sun_uflash.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c index 2bfdf1b7e18a..f58cfb15d6e8 100644 --- a/drivers/mtd/maps/sun_uflash.c +++ b/drivers/mtd/maps/sun_uflash.c @@ -118,7 +118,7 @@ static int uflash_probe(struct platform_device *op) return uflash_devinit(op, dp); } -static int uflash_remove(struct platform_device *op) +static void uflash_remove(struct platform_device *op) { struct uflash_dev *up = dev_get_drvdata(&op->dev); @@ -132,8 +132,6 @@ static int uflash_remove(struct platform_device *op) } kfree(up); - - return 0; } static const struct of_device_id uflash_match[] = { @@ -151,7 +149,7 @@ static struct platform_driver uflash_driver = { .of_match_table = uflash_match, }, .probe = uflash_probe, - .remove = uflash_remove, + .remove_new = uflash_remove, }; module_platform_driver(uflash_driver); From patchwork Sun Oct 8 20:01:41 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: 1844946 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=XAtVfU5F; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y432yxQz20cr for ; Mon, 9 Oct 2023 07:02:43 +1100 (AEDT) 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=qBv6C73i54TMU8A4hnG1g/ATrjOSPf2nebtOdDVI33w=; b=XAtVfU5FaKliOL yrYnHr5k8+XbMRugn6P+kxqmG9oXMUR768ppP7sBak3iSkmPXzTEdiwCtWG7dQVCnnwa7fjq9ZRiR /V31L3sAceXlmubUs4p7mJ4zZwV1AZFti2+evahZKR0OmSrCcdMI1wd/p01R2AyDvJ+RNpXNfyo3c +oIEsrnuxHnEd5TjUCRBiUMDykc6pMxiZ0yIIZxBui1yaSq+R07W7hfPoway4PJpM/fFExXGUqm/+ 7PoNIeB9Xp8Dwr4R1FTaezLKH1+NUbbRl2XQ1ZswZqtzfdja08TGxeAN/s/U/TBIhjYQvGwWrxtpm zAIe9YiB4lEylXY5LRkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyh-009Dzn-1x; Sun, 08 Oct 2023 20:02:15 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyW-009DrD-1j for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:09 +0000 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 1qpZyR-0001i5-Ar; Sun, 08 Oct 2023 22:01:59 +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 1qpZyQ-000F0C-KT; Sun, 08 Oct 2023 22:01:58 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyQ-00Bf1A-BJ; Sun, 08 Oct 2023 22:01:58 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 18/20] mtd: rawnand: txx9ndfmc: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:41 +0200 Message-Id: <20231008200143.196369-19-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1919; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=3YydtaRiKRjnB5+u2dYxhI3rACGp6Jp3hUAaOKD2+TA=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwqbKrMFG1XMpWFGArZ5DC4FWM2T+w1KoiMH2 UQMMNu/zYiJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKmwAKCRCPgPtYfRL+ TmleB/9GoikonMpQzsoue8bY4zkTR2DUMlhr7WgB8GKcA85K6GphUNcrIlGGGAa20Q6D5b72jHH mYzmo0MOL4QlTOGVXNkFOq+9FD0O0w/M115Lew9kxbkU6ZQotm8P1MdKdq+ryK8JUYoQtvfdH5M GX8M+OotZJCDjKn6ywUPdp344uQRGq6E6aXnbKtDh6/Ng8dYersSJC9yq26LATDQNn+JhFrW+yI opOdqMQ0rE9fP24vJ9J0uTOu6PZXyc3SkH/uIN02rz84g1Nibb2CTlFrPhEUq5nF7rM7j5bFdN+ q2ss4BUPeD6LcIhtx/Y3jnHDNsN84k5WTE+jSqo3jtNqb3K1 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130204_573246_3A63A3A6 X-CRM114-Status: GOOD ( 15.82 ) X-Spam-Score: -0.7 (/) 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/nand/raw/txx9ndfmc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/raw/txx9ndfmc.c b/drivers/mtd/nand/raw/txx9ndfmc.c index 83dd092d22ee..e5a94d51c536 100644 --- a/drivers/mtd/nand/raw/txx9ndfmc.c +++ b/drivers/mtd/nand/raw/txx9ndfmc.c @@ -369,7 +369,7 @@ static int __init txx9ndfmc_probe(struct platform_device *dev) return 0; } -static int __exit txx9ndfmc_remove(struct platform_device *dev) +static void __exit txx9ndfmc_remove(struct platform_device *dev) { struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); int ret, i; @@ -390,7 +390,6 @@ static int __exit txx9ndfmc_remove(struct platform_device *dev) kfree(txx9_priv->mtdname); kfree(txx9_priv); } - return 0; } #ifdef CONFIG_PM @@ -411,7 +410,7 @@ static int txx9ndfmc_resume(struct platform_device *dev) * triggering a section mismatch warning. */ static struct platform_driver txx9ndfmc_driver __refdata = { - .remove = __exit_p(txx9ndfmc_remove), + .remove_new = __exit_p(txx9ndfmc_remove), .resume = txx9ndfmc_resume, .driver = { .name = "txx9ndfmc", From patchwork Sun Oct 8 20:01:42 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: 1844959 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=DPl8H+cy; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y4B6d5Rz26jW for ; Mon, 9 Oct 2023 07:02:50 +1100 (AEDT) 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=1S/lV7ki/jLhx+eFRhu7DqkDm+wHajd/mPX9226CxOY=; b=DPl8H+cy+wwWwT 2mCs8eZ22SlGGlIAjUUiDiceUe7P5ZvZIPUyHn9Z3eIm5VBy3rLiNZwvBEzT1cdKagUCKhYCzFrx/ dYrsZlbawFbVlEH+pNSRrGz1XBJ651pGGqmOrzf+4DEbpZ86A5rsw4OmQII3GT3CMkI58MLTWgArH ptUbzi6nft2rp0Y8Vs4HbyVPoJsEaUEjrczxx35UQCSD54aTDYrkjOfyt31yRIA1lf07Rsd//o1KJ tSOWWeork2GW4h7ZSfp52KRfqJfeus39ct1b3IFN1k0amtI2J1JDiXQiHtBVvmTwcabYQwRr1BsoB msXYXL1Hw7isGAx5NMPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyg-009DzF-2l; Sun, 08 Oct 2023 20:02:14 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyW-009Dsw-2C for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:09 +0000 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 1qpZyR-0001jY-RU; Sun, 08 Oct 2023 22:01:59 +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 1qpZyQ-000F0G-Sv; Sun, 08 Oct 2023 22:01:58 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyQ-00Bf1E-Jj; Sun, 08 Oct 2023 22:01:58 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Tudor Ambarus , Pratyush Yadav , Michael Walle , linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 19/20] mtd: spi-nor: hisi-sfc: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:42 +0200 Message-Id: <20231008200143.196369-20-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1843; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=Lo52HVmr5VLMhAl1V/VKNHnPC6lvCn1fTq76slX2lfw=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwqd4XJRvfdGm6kta8wgivPKUF7GxHWV2DQk5 u7dUp20ojyJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKnQAKCRCPgPtYfRL+ Tm6qB/oDnwZZvNq3hNJKLm2F3em+p1P0NVSa3HTGhHMbhqgnJu5cuxdLr50SwAFSZwziYFL3hlN alKQla/w2xTWi1Aw9amC9/CeOl+NPPlLnu5hahmvk+83FBc5hY+4x6wsV7GXvOtmTmjz1/mGmG7 5FNV3T5Onp4vI1t0bx/9l3D1uWuSL4fOWr38k+2nAcGRv+DDEjFevq8mQr7Zu9e1HRFlpzZgMZd v28+SYlKvrNjr00apUw5xiXuw2WqlAEsPnbjU0gjPtWtjpKX+XVkwAR1KZpNRiamH0Keb8Nkd1F RayZsc/RQJWEcgLFEXQXLEnY6UMSFL6zhdIZtTPAIzGUc8et 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130204_713210_08BFE9A8 X-CRM114-Status: GOOD ( 15.80 ) X-Spam-Score: -0.7 (/) 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/spi-nor/controllers/hisi-sfc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi-nor/controllers/hisi-sfc.c b/drivers/mtd/spi-nor/controllers/hisi-sfc.c index 5070d72835ec..89a7f0bbc4b3 100644 --- a/drivers/mtd/spi-nor/controllers/hisi-sfc.c +++ b/drivers/mtd/spi-nor/controllers/hisi-sfc.c @@ -468,13 +468,12 @@ static int hisi_spi_nor_probe(struct platform_device *pdev) return ret; } -static int hisi_spi_nor_remove(struct platform_device *pdev) +static void hisi_spi_nor_remove(struct platform_device *pdev) { struct hifmc_host *host = platform_get_drvdata(pdev); hisi_spi_nor_unregister_all(host); mutex_destroy(&host->lock); - return 0; } static const struct of_device_id hisi_spi_nor_dt_ids[] = { @@ -489,7 +488,7 @@ static struct platform_driver hisi_spi_nor_driver = { .of_match_table = hisi_spi_nor_dt_ids, }, .probe = hisi_spi_nor_probe, - .remove = hisi_spi_nor_remove, + .remove_new = hisi_spi_nor_remove, }; module_platform_driver(hisi_spi_nor_driver); From patchwork Sun Oct 8 20:01:43 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: 1844950 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=MVT3r46m; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3Y483cQqz20Vh for ; Mon, 9 Oct 2023 07:02:48 +1100 (AEDT) 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=LHjcpBqWz0Y1CZbIhxYMY7ct6t9hDFOJpQgd4VjljjQ=; b=MVT3r46mRvh9SK J4RgOpSVNnOrISwjd+cBa3KZuZ/aildKsdAwBiOqCPlYwwmIEahekgn3kyqi+8HhcocyD30XF4ELN NVTRUU5QcA6d3cLOrwKIYRCTjHbjHyBPui452X7WskFtzDbOttjlH8HfEYRWU/f/KoNy5RWF2CLxZ Q3KRiKAzJKasMggchbWNsRbr///ZQWFY2LSD1CtOQBzOmFUMB4yaGJBRdDTAGtWObHnw978W/MQcy 9rTFFVeXg4aAnEgkgsCNv4aFzpsEw4el95Y0Mh1XdK/BzAg28F91Cp/Zu9eKGgyCAR88E5tsS3phj qTzgEJE9sWS1IwhqIB1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyn-009E5k-0i; Sun, 08 Oct 2023 20:02:21 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpZyf-009Dxj-0G for linux-mtd@lists.infradead.org; Sun, 08 Oct 2023 20:02:15 +0000 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 1qpZyS-0001jy-7z; Sun, 08 Oct 2023 22:02:00 +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 1qpZyR-000F0J-6O; Sun, 08 Oct 2023 22:01:59 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qpZyQ-00Bf1I-TB; Sun, 08 Oct 2023 22:01:58 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Vladimir Zapolskiy , Tudor Ambarus , Pratyush Yadav , Michael Walle , linux-arm-kernel@lists.infradead.org, linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 20/20] mtd: spi-nor: nxp-spifi: Convert to platform remove callback returning void Date: Sun, 8 Oct 2023 22:01:43 +0200 Message-Id: <20231008200143.196369-21-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> References: <20231008200143.196369-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1821; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=naz45ZlLPwuwObvGjtIvJZJclRSSvFqpgxi8Vbmk5oQ=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlIwqgidnwISLnn2wlQt26cGtIzR7Y6RfHiW5ew nWe+F3AGviJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSMKoAAKCRCPgPtYfRL+ TpZLB/wMwRsJwHP5D+q/AN+C7fE2cZticbk4ps8j7K6f/A+ZuDkYkXnnxY8rkLY098OXTKNqg6k k4UWUeBEwapzxprlQulJ5QCDqFhgr7L7+amLT7D6ovilKTlYhabfqKR0ppMJT8qFsDore19Mc06 n2lWdKEI9xDgDdjXOHO4BFgYe7keLLrh6qQ15PsRRfN5+yn+pWE1Eey9a3g1ypjqXrhhIjDqW/6 icqS/G63POyYuDDfNWBZ9LnEXWoSvU2H99F6Jm0agBsNrSdlWmk7Kp5ASvmZvbzdLpxwFoaCjsm 4lvzmOubUyGt3KquyDUIYH1td9UO/oquiQSZJ360Xs7lCGeo 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-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_130213_128284_61141C44 X-CRM114-Status: GOOD ( 16.26 ) X-Spam-Score: -0.7 (/) 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2a0a:edc0:2:b01:1d:0:0:104 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 .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/mtd/spi-nor/controllers/nxp-spifi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/spi-nor/controllers/nxp-spifi.c b/drivers/mtd/spi-nor/controllers/nxp-spifi.c index 5d8f47ab146f..5aee62f51031 100644 --- a/drivers/mtd/spi-nor/controllers/nxp-spifi.c +++ b/drivers/mtd/spi-nor/controllers/nxp-spifi.c @@ -431,13 +431,11 @@ static int nxp_spifi_probe(struct platform_device *pdev) return 0; } -static int nxp_spifi_remove(struct platform_device *pdev) +static void nxp_spifi_remove(struct platform_device *pdev) { struct nxp_spifi *spifi = platform_get_drvdata(pdev); mtd_device_unregister(&spifi->nor.mtd); - - return 0; } static const struct of_device_id nxp_spifi_match[] = { @@ -448,7 +446,7 @@ MODULE_DEVICE_TABLE(of, nxp_spifi_match); static struct platform_driver nxp_spifi_driver = { .probe = nxp_spifi_probe, - .remove = nxp_spifi_remove, + .remove_new = nxp_spifi_remove, .driver = { .name = "nxp-spifi", .of_match_table = nxp_spifi_match,