Re: [PATCH v1] rust: pwm: use pin_init::zeroed() to initialize pwm_ops

From: Francis Laniel

Date: Tue Jun 02 2026 - 03:12:40 EST


Hi,

Le vendredi 29 mai 2026, 19:45:06 heure d’été d’Europe de l’Est Miguel Ojeda a
écrit :
> On Fri, May 29, 2026 at 5:48 PM Francis Laniel
>
> <laniel_francis@xxxxxxxxxxxxxxxxxxx> wrote:
> > Replace unsafe block containing core::mem::zeroed by calling
> > pin_init::zeroed().
> > This is safer, as this function is guarded by trait contrary to
> > core::mem:zeroed().
>
> It is definitely safer, but it is actually fully safe, i.e. it is a
> safe `const fn` after all, which is great. I would say removing
> `unsafe` code is the justification, even if of course the function is
> able to be safe thanks to implementing the trait only for certain
> types. (Also missing `:`).
>
> I would suggest reusing Benno's commit message from the series he
> links in the issue instead, e.g.
>
> https://lore.kernel.org/all/20250814093046.2071971-8-lossin@xxxxxxxxxx/
>
> > Link: https://github.com/Rust-for-Linux/linux/issues/1189
>
> Please use Suggested-by like the issue mentions :)
>
> Suggested-by: Benno Lossin <lossin@xxxxxxxxxx>

I read the issue too fast! I will send a v2 with the corresponding tags and
new commit message! Thank you for your suggestions!

> Thanks!
>
> Cheers,
> Miguel

Best regards,