Re: [PATCH v2] clocksource/drivers/timer-imx-gpt: fix resource leak on init error paths

From: Krzysztof Kozlowski

Date: Fri Oct 09 2026 - 02:15:27 EST



On Fri, 09 Oct 2026 10:28:18 +0800, Haotian Zhang wrote:
> mxc_timer_init_dt() maps the timer registers with of_iomap() and obtains
> the ipg and per clocks with of_clk_get_by_name(), but every error path
> jumps to err_kfree, which only frees the imx_timer structure. The
> ioremap'd mapping, the clock references and the mapping created by
> irq_of_parse_and_map() are leaked when irq_of_parse_and_map() or
> _mxc_timer_init() fails.
>
> Release the ioremap mapping when irq_of_parse_and_map() fails, and drop
> the clock references and the IRQ mapping when _mxc_timer_init() fails.
>
> _mxc_timer_init() can fail after mxc_clocksource_init() has registered
> the sched_clock and the clocksource, and after mxc_clockevent_init() has
> registered the clock event device. Those subsystems keep using
> imxtm->base and imxtm, so neither the mapping nor imxtm itself may be
> released on that path; request_irq() cannot have succeeded there, so
> disposing the IRQ mapping is safe.
>
> Fixes: 8051a993ce22 ("clocksource/drivers/timer-imx-gpt: Fix potential memory leak")
> Assisted-by: DeepSeek-V4.1-Flash
> Suggested-by: Frank Li <Frank.li@xxxxxxxxxxx>
> Signed-off-by: Haotian Zhang <vulab@xxxxxxxxxxx>
> ---
> Changes in v2:
> - Dispose the IRQ mapping and drop the clock references when
> _mxc_timer_init() fails, instead of leaking the IRQ mapping.
> - Do not unmap imxtm->base nor free imxtm on that path: the sched_clock,
> the clocksource and the clock event device may already have been
> registered and keep using them.
>
> drivers/clocksource/timer-imx-gpt.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>



Multiple things here:
1. Your team ignored completely previous feedback.

2. You use multiple identities with this email, thus I actually doubt we speak
with actual person.

3. Finally, same feedback:
You sent multiple independent patches, to multiple independent
subsystems. The amount of these patches clearly suggest this was
AI generated and most likely not tested.

More importantly, you sent all this work without properly organizing
relevant patches into patchsets. This makes reviewing difficult
and might cause multiple reviewers to address the same issue.
Replying to the entire set is impossible and requires handling each
patch independently, instead of applying or discarding the set.
Maintainers also won't see the bigger picture of your work. Quite
worrying.

This is on the verge of hostile patch: bomb us with so many
contributions, we won't be able to handle them in efficient manner,
like responding ONCE to ask you to slow down. Considering all this
is untested and LLM generated, I have even more doubts whether this
should be considered for review.

Please read kernel documentation BEFORE posting more work. It will
explain you how to identify subsystems, how to organize your work per
subsystem (so a patchset grouping multiple patches with a short cover
letter), how to document usage of LLM and how what you should not do
if this was posted in a good faith.

Best regards,
Krzysztof