Re: [PATCH] rust: device: fix device context of Device::parent()
From: Alexandre Courbot
Date: Thu Oct 16 2025 - 22:55:29 EST
On Thu Oct 16, 2025 at 10:31 PM JST, Danilo Krummrich wrote:
> Regardless of the DeviceContext of a device, we can't give any
> guarantees about the DeviceContext of its parent device.
>
> This is very subtle, since it's only caused by a simple typo, i.e.
>
> Self::from_raw(parent)
>
> which preserves the DeviceContext in this case, vs.
>
> Device::from_raw(parent)
>
> which discards the DeviceContext.
>
> (I should have noticed it doing the correct thing in auxiliary::Device
> subsequently, but somehow missed it.)
>
> Hence, fix both Device::parent() and auxiliary::Device::parent().
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: a4c9f71e3440 ("rust: device: implement Device::parent()")
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
Ouch, that will make me think twice the next time I consider using
`Self` for convenience... :)
Reviewed-by: Alexandre Courbot <acourbot@xxxxxxxxxx>