From patchwork Tue Sep 24 18:56:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13811122 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ACA52CF9C69 for ; Tue, 24 Sep 2024 18:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:Subject:From:Cc:To:MIME-Version:Date:Message-ID:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=xtgGbVbvQUG8PMEUJblOJ8LFdHNg6Vwo3Ynbfh+i3qM=; b=U8sC+WgdVAqcySRClKecXZUJ9B G0OMdVKLa5kY84g4BdsS5t3Qy9/N9ZC9017n4BbZidAmWqy52SO0ecoVjYK9U/Q2bmRMH8GTL/8rs 12MAOtfdYfPHZ1/TFM2GoEd4GLDg2nG8tqouDi9kHyaVWb0w47oCaKtNcgkZqxhv1yXd3gayjdqxc /1Rhv07g0WSPqK6svaG1E7hQRBzfqqrkWJo5fXfFJAumjbZlKLCOvDMx+/N6hj1QXTnLVxiqbed4r oH/TjHxmzCmKpoTQu2SPgX3YZ0UAWM6wDzArXRc9qHZJe+ClrvgoI8Q9cxMZBjDpAgiAB+p1r8LR6 AcwZDF+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stAjC-000000036rO-2Xom; Tue, 24 Sep 2024 18:57:38 +0000 Received: from mout.web.de ([212.227.17.12]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1stAi2-000000036it-1YKB; Tue, 24 Sep 2024 18:56:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1727204171; x=1727808971; i=markus.elfring@web.de; bh=xtgGbVbvQUG8PMEUJblOJ8LFdHNg6Vwo3Ynbfh+i3qM=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:To:Cc:From: Subject:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=pBEI3FVIc1IfThbHLTs5fZWx+EyfCYbnXCIwbI9TYt2HvYap1b+FDPajviduVN9+ 6f7kgepm0b7olCGuxGYWuXRUc1hr4yGUhxKx8WwOiZl0W1qC/dGq48HJ56Nq56HF9 mZcM5CDCZnN6I4p7tFU74N6YWtkfJcRMJ1mnxUrJAhWmttFW7h18DDRN17CB/svi9 jRifesdsIwyvCzLPP0Rn8oGvjZqp4F5fx13CaxmlRUrkCky1tXpw2+tpUJSnfgpjt mG4YfnwYWwNVzFH7XOCApgOAMJVEj4+DZYDnd/WxhuRdEBB2DsMPlhmlz5kRyvgnS VSWxFLU7IEdOpLrBiQ== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.85.95]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MMGuC-1scC3J0dRW-00Jte0; Tue, 24 Sep 2024 20:56:11 +0200 Message-ID: <9e736d33-b07f-40a0-8fb6-8c3212593b77@web.de> Date: Tue, 24 Sep 2024 20:56:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org, Angelo Gioacchino Del Regno , Leilk Liu , Mark Brown , Matthias Brugger Content-Language: en-GB Cc: LKML , kernel-janitors@vger.kernel.org From: Markus Elfring Subject: [PATCH] spi: slave-mt27xx: Call clk_disable_unprepare() only once in mtk_spi_slave_probe() X-Provags-ID: V03:K1:lAmuIvmJ2DJWOgYJ5Dc3Jikut72syDFBPNFRoqxnjuz6Ujva0lB qiZZ+p9Wuxrm2ek3g7UBLIulwG6eCJEvYXPPIPxqBDMqtEXbDY94QGDrxQn5c5fjQoxxiGw Lwp3TOi9wLEY3G+3wgwtUeguwD6xYEG2ZBC+UXUbdvG3Srwb83eC9k+/gP71gaZud1wtsX/ Hret41lADO+dIUB9dihyw== UI-OutboundReport: notjunk:1;M01:P0:P16q0sytqk8=;H2wCb/e128pNNd7DaC2wcQLJfUD ldEzgMl/8BflG0oXh31sV/bNA9hFclbt87UQtMPh52YFdLDaBekekaGAXks9PhdDaxCl5Flpj j1m+zimbcWy0Psdy7bKiK1p7ijljub/bkBaE6TKwMnhvt88rSVex80oCiBuqzdGE7KxK+G5/E 1sY201r6hljICeXuqGB+PuhWTxr7kX9+db+i275D7364JnV5iNUoDTFdshgCaSOake7rJNw6q Pd0S2JnVH/lk5BT5tCbJabKbOuBhIF5oOstzemrJQ6U1OPIkxStDzXCoIOr6dNz0KhnmKzXrn /cvWgeGg41nDFIv/PlpNsQXf7XphXgqNZbT1v1EMI+7IO74FbNFZmGae2/APxzVIxtMGlIEcd aFpL3lEqekkHpNVphjxjQnFYM2diBgb4vPxVkVQT2NvnM581eX4A9Szm/EtjXKh+9IjAwMMCN 9ZHgtw2yT10XVILFSKdMnv9PoB0ESpp3qgaESI/Nlq0L8FcsYLuvYwOZ5d5m/d4qYY+sn8ZEh /qdobvZZ7sirsFSoGqCW4t95Tu7bot7r02j65mKQlcrM5LhdlEN+/pu4+//5oQRj2Gpkc4dwm 0xnw+oRGhFh9/P9UKCoDv8CvzO/RPTkBo53dZOtRKqZ7vwevZ7nBPwjqpFUshTbbxDVrrWU4j HvQyUkG/IvjHNmPzj1EugMbJ3ZZglGk7omraGq9cWo+6IOV6t2aJzMC53s/UjkXO1+fv8fC1R fEMGxCu0dOHyGqcVpWZFYLqm68SAgkCwNlfxzEdMjpu2kmlpkfXFHcc06JY8V9mmYQIh4yoh6 XQjnvY8mf2VL9iJiS0PgddWg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240924_115626_809143_D75195A1 X-CRM114-Status: UNSURE ( 7.81 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Markus Elfring Date: Tue, 24 Sep 2024 20:47:29 +0200 A clk_disable_unprepare(mdata->spi_clk) call was immediately used after a return value check for a devm_spi_register_controller() call in this function implementation. Thus call such a function only once instead directly before the check. This issue was transformed by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/spi/spi-slave-mt27xx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.46.1 diff --git a/drivers/spi/spi-slave-mt27xx.c b/drivers/spi/spi-slave-mt27xx.c index 4a91b7bae3c6..40e1e7de0742 100644 --- a/drivers/spi/spi-slave-mt27xx.c +++ b/drivers/spi/spi-slave-mt27xx.c @@ -455,15 +455,13 @@ static int mtk_spi_slave_probe(struct platform_device *pdev) pm_runtime_enable(&pdev->dev); ret = devm_spi_register_controller(&pdev->dev, ctlr); + clk_disable_unprepare(mdata->spi_clk); if (ret) { dev_err(&pdev->dev, "failed to register slave controller(%d)\n", ret); - clk_disable_unprepare(mdata->spi_clk); goto err_disable_runtime_pm; } - clk_disable_unprepare(mdata->spi_clk); - return 0; err_disable_runtime_pm: