Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] Use of `kernel::` instead of `crate::` for intra-crate imports and 
paths.
--

commit 5d83778cf519ec33130e7eef0e627d3e0a92700a
Author: Andreas Hindborg <[email protected]>

rust: implement ForeignOwnable for Owned

This commit implements ForeignOwnable for Owned<T>, which allows it to be
used in places such as the XArray.

> diff --git a/rust/kernel/owned.rs b/rust/kernel/owned.rs
> index 7fe9ec3e55126..93a5dfcc1e6f5 100644
> --- a/rust/kernel/owned.rs
> +++ b/rust/kernel/owned.rs
> @@ -15,6 +15,8 @@
>      ptr::NonNull, //
>  };
>  
> +use kernel::types::ForeignOwnable;

[Severity: Low]
This isn't a bug, but should this import use crate::types::ForeignOwnable
instead of kernel::types::ForeignOwnable for an intra-crate reference?

[ ... ]

> +    #[inline]
> +    fn into_foreign(self) -> *mut kernel::ffi::c_void {

[Severity: Low]
This is also a minor style detail, but is there a reason to use kernel::
instead of crate:: for the c_void path here?

Would it be better to use crate::ffi::c_void for the return type, as well
as for the ptr arguments in from_foreign(), borrow(), and borrow_mut() below?

> +        Owned::into_raw(self).as_ptr().cast()
> +    }
> +
> +    #[inline]
> +    unsafe fn from_foreign(ptr: *mut kernel::ffi::c_void) -> Self {
> +        // SAFETY: By function safety contract, `ptr` came from 
> `into_foreign` and cannot be null.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=3

Reply via email to