From patchwork Tue Jun 7 15:24:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 1639999 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Rw4JPGEH; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LHZ2n5yQyz9sG2 for ; Wed, 8 Jun 2022 01:26:40 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aw/pOmyPu5I5eEd+ZzUAg2FlrbtOvYs5Ks56A4uXOK0=; b=Rw4JPGEHPPCtm6 ui8d1ogPTorw/m22ffsk8PR1SJ1Df4om/LywNxWNIuno+2Zf310E7wtRpLn8jn0L5VmhstEQzV4nM 8r3cZeimPfm150SYZVRcXOT9+QeN+SemdfDOl/PsqGUIE4pw+vDwpJXY687MuU3HHUymvoZ4+Oal4 E5eeeT7z7rtuQMYrFRmuqUWC4e6qyk5fKUyAIxe3JexTsxD505xsBv9EENr0IMCn+Ef/66NTXqDiS R+ghaGgpTEilE/E0Tg6Uv8WhUhIlVkNdv8ZJX3Yj8ZluYFnJUEdtyQNXnJa47ZcexTKg0RXRaVleT Ah2LGxRdBQD9a/F5OBAg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyb5F-008GZF-KO; Tue, 07 Jun 2022 15:25:29 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyb5B-008GXI-DA for linux-mtd@lists.infradead.org; Tue, 07 Jun 2022 15:25:26 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nyb4y-0003PZ-Kd; Tue, 07 Jun 2022 17:25:12 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nyb4v-0071Ab-Ot; Tue, 07 Jun 2022 17:25:08 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nyb4t-00En7S-MO; Tue, 07 Jun 2022 17:25:07 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal Cc: Richard Weinberger , Vignesh Raghavendra , Yang Yingliang , Boris Brezillon , Arvind Yadav , Lee Jones , Brian Norris , linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 1/4] mtd: st_spi_fsm: Add a clk_disable_unprepare() in .probe()'s error path Date: Tue, 7 Jun 2022 17:24:55 +0200 Message-Id: <20220607152458.232847-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607152458.232847-1-u.kleine-koenig@pengutronix.de> References: <20220607152458.232847-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1106; h=from:subject; bh=HKTCpAVmTDUjSLFUBAQZ76VBs7ELFOI+wXkFkLcsLag=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBin226LpfDiH0T0hYEEIB1znu6/w+1DNNcJX7f/OSj qEQC4KmJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYp9tugAKCRDB/BR4rcrsCdw9B/ 46x0PPgpx3wop6fAOcrmseyP08mnvzEGSjjNjfg4UwMAGufIy/gYr2cudHnNGi0b7RGqAISa0CgTME Od56IQNhygaDZUKrsdne7dWGWQWqLW+CDad//owAPha09EcPsvH+uNMSXVQ1hJVVLsu1BtRQK0Hll8 DgzGAeZkeYM4NfV7K19z5y3iq6p7jziW2yBNfwvO0VofvG7J34iICQF72XuIGPapzQefdg0pJCUAdS qFQatQ2JZ7b6Qrz7OWDBdZsj0jssDMMlfW2IGBM5/40NVKkgN/PqXECV7VTksLwS/zA53weUFvrq/k utRvXblEkkWT5gJEQr/pyh7vjtVF3p 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.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220607_082525_567734_45D5C046 X-CRM114-Status: GOOD ( 13.69 ) X-Spam-Score: -2.3 (--) X-Spam-Report: =?unknown-8bit?q?Spam_detection_software=2C_running_on_the_sy?= =?unknown-8bit?q?stem_=22bombadil=2Einfradead=2Eorg=22=2C?= =?unknown-8bit?q?_has_NOT_identified_this_incoming_email_as_spam=2E__The_ori?= =?unknown-8bit?q?ginal?= =?unknown-8bit?q?_message_has_been_attached_to_this_so_you_can_view_it_or_la?= =?unknown-8bit?q?bel?= =?unknown-8bit?q?_similar_future_email=2E__If_you_have_any_questions=2C_see?= =?unknown-8bit?q?_the_administrator_of_that_system_for_details=2E?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_Content_preview=3A__For_all_but_one_error_path_clk=5Fdisab?= =?unknown-8bit?q?le=5Funprepare=28=29_is_already?= =?unknown-8bit?q?_there=2E_Add_it_to_the_one_location_where_it=27s_missing?= =?unknown-8bit?q?=2E_Fixes=3A_481815a6193b?= =?unknown-8bit?b?ICgibXRkOiBzdF9zcGlfZnNtOiBIYW5kbGUgY2xrX3ByZXBhcmVfZW5h?= =?unknown-8bit?b?YmxlL2Nsa19kaXNhYmxlX3VucHJlcGFyZS4iKSBGaXhlczo=?= =?unknown-8bit?q?_69d5af8d016c_=28=22mtd=3A_st=5Fspi=5Ffsm=3A_Obtain_and_use?= =?unknown-8bit?q?_EMI_clock=22=29_Signed-off-by=3A?= =?unknown-8bit?b?IFV3ZSBLbGVpbmUtS8O2bmlnIDx1LmtsZWluZS1rIFsuLi5dIA==?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_Content_analysis_details=3A___=28-2=2E3_points=2C_5=2E0_re?= =?unknown-8bit?q?quired=29?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_pts_rule_name______________description?= =?unknown-8bit?q?_----_----------------------_------------------------------?= =?unknown-8bit?q?--------------------?= =?unknown-8bit?q?_-2=2E3_RCVD=5FIN=5FDNSWL=5FMED______RBL=3A_Sender_listed_a?= =?unknown-8bit?q?t_https=3A//www=2Ednswl=2Eorg/=2C?= =?unknown-8bit?q?_medium_trust?= =?unknown-8bit?b?IFsyMDAxOjY3Yzo2NzA6MjAxOjI5MDoyN2ZmOmZlMWQ6Y2MzMyBsaXN0?= =?unknown-8bit?b?ZWQgaW5d?= =?unknown-8bit?b?IFtsaXN0LmRuc3dsLm9yZ10=?= =?unknown-8bit?q?_-0=2E0_SPF=5FPASS_______________SPF=3A_sender_matches_SPF_?= =?unknown-8bit?q?record?= =?unknown-8bit?q?_0=2E0_SPF=5FHELO=5FNONE__________SPF=3A_HELO_does_not_publ?= =?unknown-8bit?q?ish_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 For all but one error path clk_disable_unprepare() is already there. Add it to the one location where it's missing. Fixes: 481815a6193b ("mtd: st_spi_fsm: Handle clk_prepare_enable/clk_disable_unprepare.") Fixes: 69d5af8d016c ("mtd: st_spi_fsm: Obtain and use EMI clock") Signed-off-by: Uwe Kleine-König --- drivers/mtd/devices/st_spi_fsm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index d3377b10fc0f..52a799cae402 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -2115,10 +2115,12 @@ static int stfsm_probe(struct platform_device *pdev) (long long)fsm->mtd.size, (long long)(fsm->mtd.size >> 20), fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10)); - return mtd_device_register(&fsm->mtd, NULL, 0); - + ret = mtd_device_register(&fsm->mtd, NULL, 0); + if (ret) { err_clk_unprepare: - clk_disable_unprepare(fsm->clk); + clk_disable_unprepare(fsm->clk); + } + return ret; } From patchwork Tue Jun 7 15:24:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 1640001 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=KmcKSc6Y; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LHZ2n3fxLz9sFs for ; Wed, 8 Jun 2022 01:26:40 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RtRJOL7VjKl1Vqf1E3J8E1se2d8gBnKmmbM6drTOtp0=; b=KmcKSc6YV2B7te VrkGqUV77VBC35yUM+qRDtMC4BBNosz8nDklIEaU3/K0qwT8d/bdZunD4M5F2G/laxLrJZvBqdLWO ZL7ETfSalf2itOjQeecYJ0XUTqRzp+jTi60C3ZmKQ5zNMPb0VTERpWOTILJJjJyM2O5WQJvCCOV/q sKQRxZDLsFZcTL2ysHs+VXLBmjpTeSxt1ToAnxL+zOZtY9O0kHn4Q4/hwRxys+V3TlwHzepR8GLmp pDNO4CU77fbs8dtc5UkIZwmhjG0LEbzkOgJYAUrRk/vqoMdD8XGQelgMhyRvV8LpCLn0aPecr3BHr tldwCz5p6bgYExWsZeVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyb5L-008GbT-Ux; Tue, 07 Jun 2022 15:25:35 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyb5B-008GXG-DC for linux-mtd@lists.infradead.org; Tue, 07 Jun 2022 15:25:28 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nyb4y-0003Pj-Kg; Tue, 07 Jun 2022 17:25:12 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nyb4v-0071Af-RT; Tue, 07 Jun 2022 17:25:08 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nyb4t-00En7V-Sn; Tue, 07 Jun 2022 17:25:07 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal Cc: Richard Weinberger , Vignesh Raghavendra , Yang Yingliang , Boris Brezillon , Arvind Yadav , Lee Jones , Brian Norris , linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 2/4] mtd: st_spi_fsm: Warn about failure to unregister mtd device Date: Tue, 7 Jun 2022 17:24:56 +0200 Message-Id: <20220607152458.232847-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607152458.232847-1-u.kleine-koenig@pengutronix.de> References: <20220607152458.232847-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1010; h=from:subject; bh=qwfZKIhKt9e/4PnDQraudxepOBL8WgC8rvs1jgkVggI=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBin22+BgrkCZCUVx1MmEEbECzXK+gM3ZjtzayGW57V 3b9OyveJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYp9tvgAKCRDB/BR4rcrsCeQWB/ 423u9iQcSpb9xWkAEafKPktxRtnr2AXFcmDLkArOix6FM0djo4jicKkUgIPnHJWeHUqjky6TEWwZfa 6nqdHqg9ews5GEoixR/FfTxJXg1nNWGkgaR39uWdoNAPc3cuZbs0tkzOCwhbH9Ux24OLR/BzcgU/m/ TKsPoNAkIKs3xSZaR4Sog7lb4A0YU62cWq5wjSEpL5k0P1RT3BkziZEdhiazGnb7T2Aoi1jQd3n/qg wCg/jfIX93gIWDUTelBuaWyhLBq0ykBgB/Zd8RMwQYSI84caQS33dUOnie2+73n1wmv7bFbY9RduAp 5Y8bMoxl8yiULQTuvaYiNCEZJ2mQ0e 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.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220607_082525_566498_EA0FD378 X-CRM114-Status: GOOD ( 14.89 ) X-Spam-Score: -2.3 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: mtd_device_unregister() shouldn't fail. Wail loudly if it does anyhow. This matches how other drivers (e.g. nand/raw/nandsim.c) use mtd_device_unregister(). By returning 0 in the platform remove callback a generic error message by the device core is suppressed, nothing else changes. Content analysis details: (-2.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [2001:67c:670:201:290:27ff:fe1d:cc33 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org mtd_device_unregister() shouldn't fail. Wail loudly if it does anyhow. This matches how other drivers (e.g. nand/raw/nandsim.c) use mtd_device_unregister(). By returning 0 in the platform remove callback a generic error message by the device core is suppressed, nothing else changes. This is a preparation for making platform remove callbacks return void. Signed-off-by: Uwe Kleine-König --- drivers/mtd/devices/st_spi_fsm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 52a799cae402..a5a4b612480c 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -2130,7 +2130,9 @@ static int stfsm_remove(struct platform_device *pdev) clk_disable_unprepare(fsm->clk); - return mtd_device_unregister(&fsm->mtd); + WARN_ON(mtd_device_unregister(&fsm->mtd)); + + return 0; } #ifdef CONFIG_PM_SLEEP From patchwork Tue Jun 7 15:24:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 1640000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=eH/ENORR; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LHZ2p56Kzz9sG6 for ; Wed, 8 Jun 2022 01:26:42 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KEItepRyFqHHEUVqFljCIm7qCCfWztZJ7iK7S1Jsa0k=; b=eH/ENORRc9Mrk0 PrmI6hZ1sY59wmSvD3KKMwHr80Cit7fV5mhsk20aIEfBdNLoTWghSNxCxvWPEoX4EQemEHkJpa+Bc 8UTCeLR8WnrB0On/wShH1XlSEf4BiF6LnpQZJivCSEqwaN2zMK2OLPjVGkvDp0EXx23zJ84Pym7OJ 6SgJKotaYRLZDxAZBylNVP2jT5PZ8/IR40UyjM2+ddb3e3ft0vp4xQfx09/RJEm4Lzi3QEw4YEDu/ O/PMhOj5FvOJG3YlwRRfgW9so6D6zg5JtGvY+iHqttio67t3Fla0O0qSl3yfQc8x/genyNW95s8ML QJUlnCfLSHJ7Pi8CLqqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyb5K-008Gat-9Q; Tue, 07 Jun 2022 15:25:34 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyb5B-008GXL-DA for linux-mtd@lists.infradead.org; Tue, 07 Jun 2022 15:25:28 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nyb4y-0003Pn-Kd; Tue, 07 Jun 2022 17:25:12 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nyb4w-0071Ai-2p; Tue, 07 Jun 2022 17:25:08 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nyb4u-00En7Y-2r; Tue, 07 Jun 2022 17:25:08 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal Cc: Richard Weinberger , Vignesh Raghavendra , Yang Yingliang , Boris Brezillon , Arvind Yadav , Lee Jones , Brian Norris , linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 3/4] mtd: st_spi_fsm: Disable clock only after device was unregistered Date: Tue, 7 Jun 2022 17:24:57 +0200 Message-Id: <20220607152458.232847-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607152458.232847-1-u.kleine-koenig@pengutronix.de> References: <20220607152458.232847-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=905; h=from:subject; bh=logs5lz6EfDATRyWnzG5hsyI/yHecieo6BMzCnZSpDQ=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBin23DferXq/cyizZ7mVM5V+00cLkg0UeL3w0ytjOC jaZsmqqJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYp9twwAKCRDB/BR4rcrsCcJaB/ 9ZsEo20PUBD/HoRZ5kXyun71GNM4hqZW350u9RIrQhaWZkTClvM1QrQ0zg4gLnNTO8EQ3mrq0HC7xE 96i/BEa7nq4kMrCyXGyAWB+tAWRtBsRnw1ejtuPfdTalHfTHA31KgZhPVt6yOvE+RQ9PcvzghVZ7nu nAeKMinMMTpb5RspL3k4MusB6HcTq4P7vnn9NX9tw/RlT2XS57dLoAp/Cbkcc3dvjgBRBWTDxgePTE 8dyOCbjtDcIVKa9b70WIo4pGz4SVwkaJkI62hgnVoVyCRI9CziIkyq+fEu4reYzx2sA8m7v/QvFk03 uINDjGLARzQmTtgp/bM9coQUS5AnjW 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.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220607_082525_567953_69B02491 X-CRM114-Status: GOOD ( 14.29 ) X-Spam-Score: -2.3 (--) X-Spam-Report: =?unknown-8bit?q?Spam_detection_software=2C_running_on_the_sy?= =?unknown-8bit?q?stem_=22bombadil=2Einfradead=2Eorg=22=2C?= =?unknown-8bit?q?_has_NOT_identified_this_incoming_email_as_spam=2E__The_ori?= =?unknown-8bit?q?ginal?= =?unknown-8bit?q?_message_has_been_attached_to_this_so_you_can_view_it_or_la?= =?unknown-8bit?q?bel?= =?unknown-8bit?q?_similar_future_email=2E__If_you_have_any_questions=2C_see?= =?unknown-8bit?q?_the_administrator_of_that_system_for_details=2E?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_Content_preview=3A__Until_mtd=5Fdevice=5Funregister=28=29_?= =?unknown-8bit?q?returns_the_device_is_expected?= =?unknown-8bit?q?_to_be_operational=2E_So_only_disable_the_clock_after_the_m?= =?unknown-8bit?q?td_is_unregistered=2E?= =?unknown-8bit?q?_Fixes=3A_1fefc8ecb834_=28=22mtd=3A_st=5Fspi=5Ffsm=3A_add_m?= =?unknown-8bit?q?issing_clk=5Fdisable=5Funprepare=28=29?= =?unknown-8bit?q?_in_stfsm=5Fremove=28=29=22=29_Signed-off-by=3A_Uwe_Kleine-?= =?unknown-8bit?q?K=C3=B6nig_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E?= =?unknown-8bit?q?_---_drivers/mtd/devices/st=5Fspi=5Ffsm=2Ec_=7C_=5B=2E=2E?= =?unknown-8bit?q?=2E=5D_?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_Content_analysis_details=3A___=28-2=2E3_points=2C_5=2E0_re?= =?unknown-8bit?q?quired=29?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_pts_rule_name______________description?= =?unknown-8bit?q?_----_----------------------_------------------------------?= =?unknown-8bit?q?--------------------?= =?unknown-8bit?q?_-2=2E3_RCVD=5FIN=5FDNSWL=5FMED______RBL=3A_Sender_listed_a?= =?unknown-8bit?q?t_https=3A//www=2Ednswl=2Eorg/=2C?= =?unknown-8bit?q?_medium_trust?= =?unknown-8bit?b?IFsyMDAxOjY3Yzo2NzA6MjAxOjI5MDoyN2ZmOmZlMWQ6Y2MzMyBsaXN0?= =?unknown-8bit?b?ZWQgaW5d?= =?unknown-8bit?b?IFtsaXN0LmRuc3dsLm9yZ10=?= =?unknown-8bit?q?_-0=2E0_SPF=5FPASS_______________SPF=3A_sender_matches_SPF_?= =?unknown-8bit?q?record?= =?unknown-8bit?q?_0=2E0_SPF=5FHELO=5FNONE__________SPF=3A_HELO_does_not_publ?= =?unknown-8bit?q?ish_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 Until mtd_device_unregister() returns the device is expected to be operational. So only disable the clock after the mtd is unregistered. Fixes: 1fefc8ecb834 ("mtd: st_spi_fsm: add missing clk_disable_unprepare() in stfsm_remove()") Signed-off-by: Uwe Kleine-König --- drivers/mtd/devices/st_spi_fsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index a5a4b612480c..9f6d4dd8bade 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -2128,10 +2128,10 @@ static int stfsm_remove(struct platform_device *pdev) { struct stfsm *fsm = platform_get_drvdata(pdev); - clk_disable_unprepare(fsm->clk); - WARN_ON(mtd_device_unregister(&fsm->mtd)); + clk_disable_unprepare(fsm->clk); + return 0; } From patchwork Tue Jun 7 15:24:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 1640003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=2bNOKyw7; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LHZ2r6xqdz9sG2 for ; Wed, 8 Jun 2022 01:26:44 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kduUfWXWqdx1wfbsKopDMpl4q5uskySu6LXnFyiQ4TU=; b=2bNOKyw7dLjuOq 1BsyBAFOp2Hq8z0xaznkLIywYTis9DimuBm7Gp8pG5NEizWnepHoT95bH43zBZAktKY3KtrjzAtln 8Qoz8tNdDnqcdnQf+a2EYAGq2k/rPaQ0D4qZofVaohGtffLvADzpsoifCDmzadbm4CT/MuOky4TEl hUjM/BkcEdY9G81s7hFpGQhH4YN6Q8RbSjlV6GOgCZ9nLF0xCzeJKFEiSsBOtuHH9QSzm7565cEPA Gor2aq7IxGax8GAoZV8ggxO5spTGxNAmC6MqGfbRegXQqRuKJtv9EDJ6yFo9tM9q+QptjRexx1JV6 QBWMedwNchUh8iF8Cymg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyb5H-008GaC-DM; Tue, 07 Jun 2022 15:25:31 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyb5B-008GXJ-D9 for linux-mtd@lists.infradead.org; Tue, 07 Jun 2022 15:25:27 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nyb4y-0003Pp-Ka; Tue, 07 Jun 2022 17:25:12 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nyb4w-0071Al-8Y; Tue, 07 Jun 2022 17:25:08 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nyb4u-00En7b-7z; Tue, 07 Jun 2022 17:25:08 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Miquel Raynal Cc: Richard Weinberger , Vignesh Raghavendra , Yang Yingliang , Boris Brezillon , Arvind Yadav , Lee Jones , Brian Norris , linux-mtd@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 4/4] mtd: st_spi_fsm: Simplify error checking in .probe() a bit Date: Tue, 7 Jun 2022 17:24:58 +0200 Message-Id: <20220607152458.232847-5-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607152458.232847-1-u.kleine-koenig@pengutronix.de> References: <20220607152458.232847-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1289; h=from:subject; bh=o5H1jC7/6G9wlRAh5/csKl0ZFZFqRyIpFnfdF8rC0pU=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBin23Hif/h8sszQ/5gU9lgiqo0TFSnlN85VYBFX6tE EeFjTXyJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYp9txwAKCRDB/BR4rcrsCcDwB/ sFIRSuv/YlesaXanjXgheqm/3VggT14p3BFdymqLykFQUYfdSBFA0tOr9rhiAz4tiKwVGmXZTiYbdn 8FlxlloPO2Co64vYJBSRDGOCQgYxn1wfz8n3eOpoxirkPfF2rolx00gBxhmtzglJIeu/GFKkB3h/Uf chAsfAyi5/n0JZJpD3u1XU2mqwTU0p/qZumMMwLzPuZs6BYIduTglJTFB7KcTjVzVQwJwq8+ra2CNH rGW30oRofRM5Pgc8wPOIh/9lO2rFtnsxxy6mO/XT2B8x2sDSBJHL9VFLFWcWjYLS1uVscb+usvZg0i Hn5CR/Wu5OudY7M6FDEt3SLKIy3wmS 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.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220607_082525_556022_977F6C7B X-CRM114-Status: GOOD ( 15.76 ) X-Spam-Score: -2.3 (--) X-Spam-Report: =?unknown-8bit?q?Spam_detection_software=2C_running_on_the_sy?= =?unknown-8bit?q?stem_=22bombadil=2Einfradead=2Eorg=22=2C?= =?unknown-8bit?q?_has_NOT_identified_this_incoming_email_as_spam=2E__The_ori?= =?unknown-8bit?q?ginal?= =?unknown-8bit?q?_message_has_been_attached_to_this_so_you_can_view_it_or_la?= =?unknown-8bit?q?bel?= =?unknown-8bit?q?_similar_future_email=2E__If_you_have_any_questions=2C_see?= =?unknown-8bit?q?_the_administrator_of_that_system_for_details=2E?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_Content_preview=3A__Instead_of_ending_each_if_branch_with_?= =?unknown-8bit?q?the_same_check=2C_do_it?= =?unknown-8bit?q?_once_unconditionally_after_the_if_block=2E_Signed-off-by?= =?unknown-8bit?q?=3A_Uwe_Kleine-K=C3=B6nig?= =?unknown-8bit?q?_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E_---_Not_entirel?= =?unknown-8bit?q?y_sure_this_is_an_objective?= =?unknown-8bit?q?_improvement=2C_but_I_like_it_better_this_way=2E_?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_Content_analysis_details=3A___=28-2=2E3_points=2C_5=2E0_re?= =?unknown-8bit?q?quired=29?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_pts_rule_name______________description?= =?unknown-8bit?q?_----_----------------------_------------------------------?= =?unknown-8bit?q?--------------------?= =?unknown-8bit?q?_-2=2E3_RCVD=5FIN=5FDNSWL=5FMED______RBL=3A_Sender_listed_a?= =?unknown-8bit?q?t_https=3A//www=2Ednswl=2Eorg/=2C?= =?unknown-8bit?q?_medium_trust?= =?unknown-8bit?b?IFsyMDAxOjY3Yzo2NzA6MjAxOjI5MDoyN2ZmOmZlMWQ6Y2MzMyBsaXN0?= =?unknown-8bit?b?ZWQgaW5d?= =?unknown-8bit?b?IFtsaXN0LmRuc3dsLm9yZ10=?= =?unknown-8bit?q?_-0=2E0_SPF=5FPASS_______________SPF=3A_sender_matches_SPF_?= =?unknown-8bit?q?record?= =?unknown-8bit?q?_0=2E0_SPF=5FHELO=5FNONE__________SPF=3A_HELO_does_not_publ?= =?unknown-8bit?q?ish_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 Instead of ending each if branch with the same check, do it once unconditionally after the if block. Signed-off-by: Uwe Kleine-König --- Not entirely sure this is an objective improvement, but I like it better this way. It could be shorted one step further by doing ret = (info->config ?: stfsm_prepare_rwe_seqs_default)(fsm); if (ret) goto err_clk_unprepare; but IMHO readability suffers here. drivers/mtd/devices/st_spi_fsm.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 9f6d4dd8bade..54861d889c30 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -2084,15 +2084,12 @@ static int stfsm_probe(struct platform_device *pdev) * Configure READ/WRITE/ERASE sequences according to platform and * device flags. */ - if (info->config) { + if (info->config) ret = info->config(fsm); - if (ret) - goto err_clk_unprepare; - } else { + else ret = stfsm_prepare_rwe_seqs_default(fsm); - if (ret) - goto err_clk_unprepare; - } + if (ret) + goto err_clk_unprepare; fsm->mtd.name = info->name; fsm->mtd.dev.parent = &pdev->dev;