rust: device: Use as_char_ptr() to avoid explicit cast

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>
This commit is contained in:
Viresh Kumar
2025-01-16 14:04:43 +05:30
committed by Greg Kroah-Hartman
parent e1cd24af8f
commit 01b3cb6208

View File

@@ -185,7 +185,7 @@ unsafe fn printk(&self, klevel: &[u8], msg: fmt::Arguments<'_>) {
/// 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()) }
}
}