From: sashiko-bot@kernel.org
To: "Caleb James DeLisle" <cjd@cjdns.fr>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v11 4/5] clocksource/timer-econet-en751221: Support EN751627 without percpu IRQ
Date: Thu, 15 Oct 2026 17:05:47 +0000 [thread overview]
Message-ID: <sashiko-outbox-173234@kernel.org> (raw)
In-Reply-To: <20261015165404.519741-5-cjd@cjdns.fr>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] clocksource: memory leak of econet_timer.irqs on success path
--
commit ef0bb74d87af020e62a370267e55ff45f7da1e01
Author: Caleb James DeLisle <cjd@cjdns.fr>
clocksource/timer-econet-en751221: Support EN751627 without percpu IRQ
EN751627 is based on the 1004Kc which uses a different interrupt number
for each CPU timer. Support both this and the EN751221 which uses a
single percpu interrupt.
> diff --git a/drivers/clocksource/timer-econet-en751221.c b/drivers/clocksource/timer-econet-en751221.c
> index 1859335345b59..edb3db3125ce3 100644
> --- a/drivers/clocksource/timer-econet-en751221.c
> +++ b/drivers/clocksource/timer-econet-en751221.c
[ ... ]
> static int __init timer_init(struct device_node *np)
> {
> - int num_blocks = DIV_ROUND_UP(num_possible_cpus(), 2);
> + int num_blocks = of_address_count(np);
> + int num_irqs = of_irq_count(np);
> struct clk *clk;
> - int ret;
> + int ret, i;
> +
[ ... ]
> + econet_timer.num_irqs = num_irqs;
> + econet_timer.irqs = kcalloc(num_irqs, sizeof(*econet_timer.irqs),
> + GFP_KERNEL);
> + if (!econet_timer.irqs)
> + return -ENOMEM;
> +
[ ... ]
> sched_clock_register(sched_clock_read, ECONET_BITS,
> econet_timer.freq_hz);
> @@ -212,6 +291,32 @@ static int __init timer_init(struct device_node *np)
> (econet_timer.freq_hz / 1000) % 1000);
>
> return 0;
[Severity: Low]
Does this code leak econet_timer.irqs on the success path?
The array is only used to populate the per-CPU cd->irq during initialization in
cevt_init() and does not appear to be accessed again. Could we safely call
kfree(econet_timer.irqs) here before returning 0, rather than retaining it
permanently?
> +
> +out_irq_free:
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261015165404.519741-1-cjd@cjdns.fr?part=4
next prev parent reply other threads:[~2026-10-15 17:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 16:53 [PATCH v11 0/5] clocksource/timer-econet-en751221: Support irq number per timer Caleb James DeLisle
2026-10-15 16:54 ` [PATCH v11 1/5] dt-bindings: timer: econet: Update EN751627 for multi-IRQ Caleb James DeLisle
2026-10-15 16:54 ` [PATCH v11 2/5] clocksource/timer-econet-en751221: Init teardown on error if possible Caleb James DeLisle
2026-10-15 16:54 ` [PATCH v11 3/5] clocksource/timer-econet-en751221: Disable IRQ until cevt registered Caleb James DeLisle
2026-10-15 17:06 ` sashiko-bot
2026-10-15 16:54 ` [PATCH v11 4/5] clocksource/timer-econet-en751221: Support EN751627 without percpu IRQ Caleb James DeLisle
2026-10-15 17:05 ` sashiko-bot [this message]
2026-10-15 16:54 ` [PATCH v11 5/5] clocksource/timer-econet-en751221: Do not use NR_CPUS for resource array size Caleb James DeLisle
2026-10-15 17:07 ` sashiko-bot
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=sashiko-outbox-173234@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=cjd@cjdns.fr \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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