rust: device: Use as_char_ptr() to avoid explicit cast
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 16 Jan 2025 08:34:43 +0000 (14:04 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Jan 2025 10:07:27 +0000 (11:07 +0100)
Use as_char_ptr() to avoid explicit cast.

Suggested-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://lore.kernel.org/r/a88cd29bf01c8fbafd5c2608357f54ea10f6e492.1737016320.git.viresh.kumar@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
rust/kernel/device.rs

index c6823decbb2e47f29c3e0acdb7b31c6c43230f2c..e7a2024b88d5547fea7f3c6f1d23de5896505b31 100644 (file)
@@ -185,7 +185,7 @@ impl Device {
     /// Checks if property is present or not.
     pub fn property_present(&self, name: &CStr) -> bool {
         // SAFETY: By the invariant of `CStr`, `name` is null-terminated.
-        unsafe { bindings::device_property_present(self.as_raw().cast_const(), name.as_ptr() as *const _) }
+        unsafe { bindings::device_property_present(self.as_raw().cast_const(), name.as_char_ptr()) }
     }
 }