Re: [PATCH] iio: accel: bma220: Fix trigger reference leak in bma220_common_probe()
From: Jonathan Cameron
Date: Sat Nov 07 2026 - 20:52:42 EST
On Fri, 06 Nov 2026 11:38:03 -0000
Wentao Liang <vulab@xxxxxxxxxxx> wrote:
> Hi Jonathan,
>
> I am sorry for the very late reply and for the extra review work caused by
> sending many similar patches without first waiting for feedback.
>
> I understand that mixing devm-managed resources with manual trigger
> cleanup is not an acceptable solution here. A broader solution needs to
> account for runtime trigger changes from userspace and distinguish the
> references that managed cleanup should release.
>
> Please disregard this patch; I will not resend this approach as v2.
I have a plan for a more general solution to these trigger references.
Hopefully will get time tomorrow to try it out.
Key I think is that we need to stop setting iio_dev->trig directly
but instead just set a iio_dev->initial_trigger and then
the get() can be done at iio_dev registration time - lining up with
code that drops the reference in the remove paths.
Anyhow, you got me to finally spend a bit of time thinking about
the lifetimes of this stuff, so thanks for the push!
Jonathan
>
> Thank you for explaining the lifetime issues and how this work should be
> submitted. This has been an important lesson for me. I will personally
> review and respond to the remaining feedback one item at a time, and I
> will keep future submissions within my capacity to follow up promptly.
>
> For transparency, we use static analysis tools to identify candidates,
> then DeepSeek and GPT-6.1 Sol to assist with auditing and preparing fixes.
> I am responsible for verifying the findings and changes before submission.
>
> Best regards,
> Wentao
>