From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=5.135.140.105 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796423035; b=dFRA0JW3uXZMoyAqdbIot8lYFQJp1B0XKz5feNUgnCCUvAeIamwGwxnfqFh/hh/ygpAJ cv3uomKkRng0HyV5FJ7CBypvO9WY5c3OjMLrj/RTDpk6iVL7t9LvNsrWC95YHre8LBoRQ PTx2g6NNsF7YzFJgP94zQ5a24wST47qfuzqGCBYQ97NQnsI9EtkOaamN2Bz/61RlzPaWB +sX7ncAK/6ugGY/uWZcc6vKpuBThllEPn9/otNQibl5WUuV7hB/brTbWWBxGdkfn1PZcm iy40iSXn1N8lS+ZmOkmjQbtD4sCVoMsYbK5gR4H/hKUjkTBObnVeEKTvzeuN+SIUVDQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796423035; h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date: Message-Id:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Last-TLS-Session-Version; bh=8v0sy2Vl6OaideGP9WtFe4Sdt3M4NcPtn4cMyyKVdUA=; b=z1voMoj9SFlE8gJcDpXI4M80ebDZ1zFeFY+uhl0kYwBsWtITN8x8nirRsBmV+iLw7RCS plXxts6y25ic4zNClCSTwGyhGUhzlU094Gf8PT2oSEJ2VHBE4ixWhOM6jCyEscd/zqkQF PbTNmm5DMhNDwny4q08Q1QxYuA6sLCLETgLFKgfYN7scRLoNMGRD8WNLT06eXdggnLR6i ZhwEAYSa8P8SoKEamecObBGls+CVN0PGIKwfJLZdhHMFuxaRLVDVms0MoFLKeKmgFu03o A7XZx1w/8bMUhL4BFmVkh6rE026rU9LcsKsgDO8N677KdXqsVspqVBozP/UnRejgePg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=cjdns.fr; spf=pass smtp.mailfrom=cjdns.fr; dkim=pass header.d=cjdns.fr header.i=@cjdns.fr header.a=rsa-sha256 header.s=dkim header.b=ku85JG4H; arc=none smtp.remote-ip=5.135.140.105 Received: from mail.cjdns.fr (mail.cjdns.fr [5.135.140.105]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3CBB606A322; Fri, 4 Dec 2026 22:23:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F3CBB606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=cjdns.fr header.i=@cjdns.fr header.a=rsa-sha256 header.s=dkim header.b=ku85JG4H Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 8F65B6EA861; Fri, 4 Dec 2026 23:23:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cjdns.fr; s=dkim; t=1796423032; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=8v0sy2Vl6OaideGP9WtFe4Sdt3M4NcPtn4cMyyKVdUA=; b=ku85JG4HiyBQSckVe3bTBYnYc7WYyyV4GoHkrKh06dVihZYl2Wk8NBDcpbWrB6rsADIBxR XWzQmTMEw00GHfA5cYRTxirUxMIi7j+vz+lRO0uYAFXh1MCoYnyOZw/qI8ptQM7vNVaWJ0 CLXTpc5cwiIUQasZ/OfEo8vbRvOXWbrs9GDPUMkYMUukol2b7p9aDpvDc5oZfK8y14ddEA aLXW7hXGb+p1WpgsDdgQym2YSc9uTSPHS1DRV2fe7wPviA2U/oSwK/px23B3h0jvB8bIpY 8EprkQ3ZBuU4LddYtQQlAg2bddMnKc4GoMiaPGh0i7W+LrY989FH78w8fPXC2g== From: Caleb James DeLisle To: linux-mips@vger.kernel.org Cc: conor+dt@kernel.org, daniel.lezcano@kernel.org, devicetree@vger.kernel.org, krzk+dt@kernel.org, linux-kernel@vger.kernel.org, naseefkm@gmail.com, robh@kernel.org, tglx@kernel.org, grandmaster@al2klimov.de, Caleb James DeLisle Subject: [PATCH RESEND v12 3/5] clocksource/timer-econet-en751221: Disable IRQ until cevt registered Date: Fri, 4 Dec 2026 22:23:32 +0000 Message-Id: <20261204222334.1085123-4-cjd@cjdns.fr> In-Reply-To: <20261204222334.1085123-1-cjd@cjdns.fr> References: <20261204222334.1085123-1-cjd@cjdns.fr> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 Eliminate a race condition where cevt_interrupt may trigger before clockevents_config_and_register has been called, and dev->event_handler is at that point NULL. Additionally, NULL check dev->event_handler in interrupt callback just in case clockevents_config_and_register failed. Signed-off-by: Caleb James DeLisle --- drivers/clocksource/timer-econet-en751221.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/clocksource/timer-econet-en751221.c b/drivers/clocksource/timer-econet-en751221.c index 714702b9ef128..f2c4c1ee0a56b 100644 --- a/drivers/clocksource/timer-econet-en751221.c +++ b/drivers/clocksource/timer-econet-en751221.c @@ -75,7 +75,10 @@ static irqreturn_t cevt_interrupt(int irq, void *dev_id) return IRQ_NONE; iowrite32(ioread32(reg_count(cpu)), reg_compare(cpu)); - dev->event_handler(dev); + + if (dev->event_handler) + dev->event_handler(dev); + return IRQ_HANDLED; } @@ -104,12 +107,11 @@ static int cevt_init_cpu(uint cpu) reg = ioread32(reg_ctl(cpu)) | ctl_bit_enabled(cpu); iowrite32(reg, reg_ctl(cpu)); - enable_percpu_irq(cd->irq, IRQ_TYPE_NONE); - - /* Do this last because it synchronously configures the timer */ clockevents_config_and_register(cd, econet_timer.freq_hz, ECONET_MIN_DELTA, ECONET_MAX_DELTA); + enable_percpu_irq(cd->irq, IRQ_TYPE_NONE); + return 0; } @@ -178,6 +180,8 @@ static int __init timer_init(struct device_node *np) goto out_membase; } + irq_set_status_flags(econet_timer.irq, IRQ_NOAUTOEN); + ret = request_percpu_irq(econet_timer.irq, cevt_interrupt, np->name, &econet_timer_pcpu); -- 2.39.5