From patchwork Thu Oct 3 08:30:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13820790 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 5CD5ECF856E for ; Thu, 3 Oct 2024 08:31:58 +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=ZX72Lmk43sBbEGkA1H10djPMZJfbXbYNCgT81G84xz8=; b=ehVMpXkWxHr5gAGqDSvAQzE1fx IZ/u43rN1b273g3jzMadJqCxsPdnzgrKktBh2TR8P/8ocv+VzHXUwIWXkJHSqDApH911Ta3Yj6m9p yo9mLn4eb1fFpt5NYs39FFvPuthHCd3tyQf0zgAnaxVk/BMQecG83gXMdp62I3IVfQ140jEufLFi8 ApjB4aaleA/9bABv1eIBf/nKqI1SY1KfqHg7IdLZeBZOGC7l099N8vxAvWlC/AWepWLPH5EFohBZX DnHgTF6hvYFZsO1SOL1iArxpZJTyrBH63ScOfd7jebG6XIolzkncXIZlL2Oi9FYhfkdsDHoHtnriu Y1urYzCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1swHFS-00000008ZjQ-3Efi; Thu, 03 Oct 2024 08:31:46 +0000 Received: from mout.web.de ([212.227.15.3]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1swHED-00000008ZZx-0AhP for linux-arm-kernel@lists.infradead.org; Thu, 03 Oct 2024 08:30:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1727944224; x=1728549024; i=markus.elfring@web.de; bh=ZX72Lmk43sBbEGkA1H10djPMZJfbXbYNCgT81G84xz8=; 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=vzNps3ohhJYOJ+Msf7DEg8nRntDbiGV47RHn7toUXDacl0xdjUYP9PniI8nhXS4J tVY5AkRoeO1/P84x/QLjsCPQhYVwwCyDRXncgwLAq/ZuW7e3FnCh/VesWniyEX22A gAywsBBmoewCMAA8xXspsj9azLKnJEI4GahA2yy+YtnzNbmOTaCvHmUHaJvl8oFQg mugvy35q+G+wvp9aD9EVxtuhMILjzxI0ev6NaJJwS1ziemwi+clBknFuHLlbMSH6A BZZQD7dSZW9tjwTsUXunQxDi08N49j8/XEmiiqqPwPA7IWH//5MOb2oCH6gpHzMMi qzhN1LBWQRbUqE3gRw== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.87.95]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MiuOW-1sHhD13LxE-00eP0o; Thu, 03 Oct 2024 10:30:23 +0200 Message-ID: <84e202eb-40f3-4132-b2d3-67069a2bba70@web.de> Date: Thu, 3 Oct 2024 10:30:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Andrew Lunn , Gregory Clement , "Rafael J. Wysocki" , Sebastian Hesselbarth , Viresh Kumar Content-Language: en-GB Cc: LKML , kernel-janitors@vger.kernel.org From: Markus Elfring Subject: [PATCH] cpufreq: mvebu: Call of_node_put(np) only once in armada_xp_pmsu_cpufreq_init() X-Provags-ID: V03:K1:l+YAhpusRDHD/2fn+ZfJHeq9qj5xFO4cNSCcfWkIMcO/apJrpO2 88Oq4JuTk1VR68J105hFn1l/i3ZxQM471Ra+kw+vb92TTqRQmq/xre4d4VFipwXBEgK23CY ga27VBWHD0m+wI5uEBPLgc9tSDLwhJRhJ9DhKH/25hT4n1wYw7VUyhHj/BiIsQwjQCaz3Op 9N66d6W63HJxcahnrSlbw== UI-OutboundReport: notjunk:1;M01:P0:6HXuvQgU8Bc=;IZ5wj26uRkiTUXg7vzESX6OubE5 0+pXKEfmMQ6E5gfU9C9VRCX29hq7Ape68GjT8dMmZM69DJEbjZBUySdLnqBnw0llJbbSFopmH bcG7gAJ8EjxGHDvYHkHRV8xQtx4cCp1DtO85dzM8TIWFU0Ox31TwdIljrxJes275cwpAwHsIk nOZhgSOevWCoS95j2YDpELre9YMAsevVHVBnl3aAVxGWFO+S0SxUKDD8dCMcblPUir9AHLfg2 HRR3yhUazVlH5pPsOh9v49cKQrNiah2yZaFyWz9NGh0iU+X6yb/EO2yzrsJIQaxtJVgSTXI0X amfBbV1N6YRsbQrNit5D6yAvoPj0QILQ8eiJPPPkArQTf2bWxOZ5+bQ4pUCTKuaPQWqhNlRkG aBe9E1W9q4USVHNORPvBC8MEb6BwHa+ThYtq1/cglq02u9dWXJ6kFm2weUxJVdNUO+LGCAt/S IRpz+scAIAnxB7PqoXu6JK4MJnn2MQCuwOb8w1X3qonzg8d7Zb8e0RZ0mDsI1cqZBL+h+eS7N W5nLDdymbdki6wFpoMxifXeNVuzYJDfWdztB3fQidQd9HQAG6j+3W8ETTSu/WGV+beMajqBsa v81E0YYDqtUJjvuVQXXJ0nm+vCBM4qcSBuUfJ1CiWKcduQ0xw0qjUBRai7YSTPPgsZiSpScUp /HqnJVSAja23fUxqjOXJirLnA7SWZw+WmqWWNcwo49g7G3VjLa1Zp7tRGDr5lhfNBMrcxRMbU k3o9A8DZ02i5SO9h2YPcsbwBNR0Zc1rrccocYWNnlZzB/qN0Aa0Ndzg6SHPez+hGT/tFXBtqC tpvWUQHRLj7kYrAGDOEEK3Ew== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241003_013029_471973_AD9F8875 X-CRM114-Status: UNSURE ( 8.42 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Markus Elfring Date: Thu, 3 Oct 2024 10:18:39 +0200 An of_node_put(np) call was immediately used after a return value check for an of_address_to_resource() 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/cpufreq/mvebu-cpufreq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.46.1 diff --git a/drivers/cpufreq/mvebu-cpufreq.c b/drivers/cpufreq/mvebu-cpufreq.c index 7f3cfe668f30..55ba7ad72c36 100644 --- a/drivers/cpufreq/mvebu-cpufreq.c +++ b/drivers/cpufreq/mvebu-cpufreq.c @@ -42,14 +42,12 @@ static int __init armada_xp_pmsu_cpufreq_init(void) return 0; ret = of_address_to_resource(np, 1, &res); + of_node_put(np); if (ret) { pr_warn(FW_WARN "not enabling cpufreq, deprecated armada-xp-cpu-clock binding\n"); - of_node_put(np); return 0; } - of_node_put(np); - /* * For each CPU, this loop registers the operating points * supported (which are the nominal CPU frequency and half of