Re: [PATCH v9 2/6] rust: pwm: Add complete abstraction layer

From: Danilo Krummrich
Date: Mon Jul 07 2025 - 05:15:22 EST


On 7/7/25 9:30 AM, Michal Wilczynski wrote:
On 7/6/25 14:23, Danilo Krummrich wrote:
If you overwrite this callback (as you do below) you're leaking the memory
allocated by pwmchip_alloc().

The simple way to solve this would be to call pwmchip_release() from here.

Thanks, a pwmchip_release() is static though, so it's either expose the
pwmchip_release in the header, or call kfree() here directly on pwmchip.

I'd export pwmchip_release() then, if you instead replicate what it does a
future change is pretty likely to be missed in the Rust abstraction.