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

Danilo Krummrich dakr at kernel.org
Mon Jul 7 02:15:05 PDT 2025


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.



More information about the linux-riscv mailing list