]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
rust: device: fix device context of Device::parent()
authorDanilo Krummrich <dakr@kernel.org>
Thu, 16 Oct 2025 13:31:44 +0000 (15:31 +0200)
committerDanilo Krummrich <dakr@kernel.org>
Fri, 17 Oct 2025 21:24:19 +0000 (23:24 +0200)
commitcfec502b3d091ff7c24df6ccf8079470584315a0
tree4489f6e2c561608c0a3d22c304be1515a2133740
parentc7fbb8218b4ad35fec0bd2256d2b9c8d60331f33
rust: device: fix device context of Device::parent()

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@vger.kernel.org
Fixes: a4c9f71e3440 ("rust: device: implement Device::parent()")
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/auxiliary.rs
rust/kernel/device.rs