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;