[PATCH 02/13] rust: error: move unsafe block into function call

From: Valentin Obst
Date: Tue Jan 16 2024 - 11:03:15 EST


The `from_err_ptr` function is safe. There is no need for the call to it
to be inside the unsafe block.

Signed-off-by: Valentin Obst <kernel@xxxxxxxxxxxxxxx>
---
rust/kernel/error.rs | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs
index 4f0c1edd63b7..6f6676bc0eb9 100644
--- a/rust/kernel/error.rs
+++ b/rust/kernel/error.rs
@@ -265,12 +265,7 @@ pub fn to_result(err: core::ffi::c_int) -> Result {
/// index: u32,
/// ) -> Result<*mut core::ffi::c_void> {
/// // SAFETY: FFI call.
-/// unsafe {
-/// from_err_ptr(bindings::devm_platform_ioremap_resource(
-/// pdev.to_ptr(),
-/// index,
-/// ))
-/// }
+/// from_err_ptr(unsafe { bindings::devm_platform_ioremap_resource(pdev.to_ptr(), index) })
/// }
/// ```
// TODO: Remove `dead_code` marker once an in-kernel client is available.
--
2.43.0