mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "William A. Kennington III" <william@wkennington.com>
To: Daniel Lezcano <daniel.lezcano@kernel.org>,
	Thomas Gleixner <tglx@kernel.org>
Cc: "Andrew Jeffery" <andrew@codeconstruct.com.au>,
	"Avi Fishman" <avifishman70@gmail.com>,
	"Tomer Maimon" <tmaimon77@gmail.com>,
	"Tali Perry" <tali.perry1@gmail.com>,
	"Patrick Venture" <venture@google.com>,
	"Nancy Yuen" <yuenn@google.com>,
	"Benjamin Fair" <benjaminfair@google.com>,
	"Joel Stanley" <joel@jms.id.au>,
	"Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
	openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	"William A. Kennington III" <william@wkennington.com>
Subject: [PATCH 1/2] clocksource/drivers/timer-npcm7xx: Fix spurious timer1 clock warning
Date: Sat, 28 Nov 2026 02:52:23 +0000	[thread overview]
Message-ID: <20261128025224.2680046-2-william@wkennington.com> (raw)
In-Reply-To: <20261128025224.2680046-1-william@wkennington.com>

of_clk_get(np, 1) returns ERR_PTR(-ENOENT), not NULL, when only one
clock is listed in the device tree. No in-tree device tree lists a
second timer clock, so the existing if (clk) check always logs a
warning on boot:

  /ahb/apb/timer@8000: Failed to get clock for timer1: -ENOENT

Ignore -ENOENT since the second clock is optional, add the missing
trailing newline, and check clk_prepare_enable() for errors.

Fixes: db78539fc95c ("clocksource/drivers/timer-npcm7xx: Enable timer 1 clock before use")
Signed-off-by: William A. Kennington III <william@wkennington.com>
---
 drivers/clocksource/timer-npcm7xx.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/clocksource/timer-npcm7xx.c b/drivers/clocksource/timer-npcm7xx.c
index 9af30af5f989..c7377f30e95a 100644
--- a/drivers/clocksource/timer-npcm7xx.c
+++ b/drivers/clocksource/timer-npcm7xx.c
@@ -202,11 +202,15 @@ static int __init npcm7xx_timer_init(struct device_node *np)
 
 	/* Enable the clock for timer1, if it exists */
 	clk = of_clk_get(np, 1);
-	if (clk) {
-		if (!IS_ERR(clk))
-			clk_prepare_enable(clk);
-		else
-			pr_warn("%pOF: Failed to get clock for timer1: %pe", np, clk);
+	if (!IS_ERR(clk)) {
+		ret = clk_prepare_enable(clk);
+		if (ret) {
+			pr_warn("%pOF: Failed to enable clock for timer1: %d\n",
+				np, ret);
+			clk_put(clk);
+		}
+	} else if (PTR_ERR(clk) != -ENOENT) {
+		pr_warn("%pOF: Failed to get clock for timer1: %pe\n", np, clk);
 	}
 
 	npcm7xx_clocksource_init();

  reply	other threads:[~2026-11-28  2:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28  2:52 [PATCH 0/2] clocksource/drivers/timer-npcm7xx: Fix timer1 warning, add sched_clock William A. Kennington III
2026-11-28  2:52 ` William A. Kennington III [this message]
2026-11-28  2:52 ` [PATCH 2/2] clocksource/drivers/timer-npcm7xx: Register timer1 as sched_clock William A. Kennington III

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261128025224.2680046-2-william@wkennington.com \
    --to=william@wkennington.com \
    --cc=andrew@codeconstruct.com.au \
    --cc=avifishman70@gmail.com \
    --cc=benjaminfair@google.com \
    --cc=daniel.lezcano@kernel.org \
    --cc=j.neuschaefer@gmx.net \
    --cc=joel@jms.id.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=tali.perry1@gmail.com \
    --cc=tglx@kernel.org \
    --cc=tmaimon77@gmail.com \
    --cc=venture@google.com \
    --cc=yuenn@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®