Re: [PATCH v8 3/5] rust: add basic serial device bus abstractions

From: Markus Probst

Date: Sat May 30 2026 - 10:52:30 EST


On Sat, 2026-05-30 at 16:35 +0200, Danilo Krummrich wrote:
> On Sat May 30, 2026 at 4:27 PM CEST, Markus Probst wrote:
> > This would work, but I don't see how it would get rid of rust_private_data in
> > this way. The device private data will but the private bus abstraction data
> > needs to outlive the devres callbacks (which is done by rust_private_data).
>
> Why? You only ever use it in the receive callback, which won't be called after
> device unbind anymore.
Because the possibility exists that some classdev ops or Drop calls
e.g. sdev.set_baudrate. This is a null pointer dereference after
serdev_device_close has been called. I interpreted it to add a state to
the abstraction private data which would prevent those calls (early
return with error) after serdev_device_close has been called, but this
would only work if it outlives these calls.

But it seems you were refering to something else with the state?

Thanks
- Markus Probst

Attachment: signature.asc
Description: This is a digitally signed message part