]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
rust: drm: don't pass the address of drm::Device to drm_dev_put()
authorDanilo Krummrich <dakr@kernel.org>
Thu, 31 Jul 2025 15:48:09 +0000 (17:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:34:43 +0000 (16:34 +0200)
commit72097f917f20fd9edc6e9436c98fa31af8f71ffd
treec641d12ab4301f56f654f7ba42963921fbe8834e
parentf46b0e361d283b47dee028fc9420f4a5bbb3f4c4
rust: drm: don't pass the address of drm::Device to drm_dev_put()

[ Upstream commit 360077278ba62e81310080f075a1a3028e778ef9 ]

In drm_dev_put() call in AlwaysRefCounted::dec_ref() we rely on struct
drm_device to be the first field in drm::Device, whereas everywhere
else we correctly obtain the address of the actual struct drm_device.

Analogous to the from_drm_device() helper, provide the
into_drm_device() helper in order to address this.

Fixes: 1e4b8896c0f3 ("rust: drm: add device abstraction")
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://lore.kernel.org/r/20250731154919.4132-5-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
rust/kernel/drm/device.rs