summaryrefslogtreecommitdiff
path: root/rust/kernel/pci.rs
diff options
context:
space:
mode:
authorDanilo Krummrich <dakr@kernel.org>2025-10-21 00:34:23 +0200
committerDanilo Krummrich <dakr@kernel.org>2025-10-29 16:40:28 +0100
commit6bbaa93912bfdfd5ffdc804275cc6a444c9400af (patch)
tree0dfcce7cb635ce77609d8a13275f4c04a70e9f5b /rust/kernel/pci.rs
parent37022410f4a3cc11614626a58cd08bcf8ea529e9 (diff)
rust: device: narrow the generic of drvdata_obtain()
Let T be the actual private driver data type without the surrounding box, as it leaves less room for potential bugs. Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'rust/kernel/pci.rs')
-rw-r--r--rust/kernel/pci.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs
index 039a0d81d363..b68ef4e575fc 100644
--- a/rust/kernel/pci.rs
+++ b/rust/kernel/pci.rs
@@ -94,7 +94,7 @@ impl<T: Driver + 'static> Adapter<T> {
// SAFETY: `remove_callback` is only ever called after a successful call to
// `probe_callback`, hence it's guaranteed that `Device::set_drvdata()` has been called
// and stored a `Pin<KBox<T>>`.
- let data = unsafe { pdev.as_ref().drvdata_obtain::<Pin<KBox<T>>>() };
+ let data = unsafe { pdev.as_ref().drvdata_obtain::<T>() };
T::unbind(pdev, data.as_ref());
}