Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] rust: kvec: missing #[inline] on push_init abstraction wrapper
--

commit 2d97ec4af5ca11c18cc395db7012f9c000c27f11
Author: Eliot Courtney <[email protected]>

rust: alloc: add Vec::push_init

This commit adds Vec::push_init, which serves as the init-infallible
version of try_push_init.

> diff --git a/rust/kernel/alloc/kvec.rs b/rust/kernel/alloc/kvec.rs
> index a2b72a7779d9d..1b7b3a1ca770a 100644
> --- a/rust/kernel/alloc/kvec.rs
> +++ b/rust/kernel/alloc/kvec.rs
[ ... ]
> @@ -369,7 +369,24 @@ pub fn push(&mut self, v: T, flags: Flags) -> Result<(), 
> AllocError> {
[ ... ]
> +    /// let mut v = KVec::<[u8; 200]>::new();
> +    /// v.push_init(init_zeroed(), GFP_KERNEL)?;
> +    /// assert_eq!(v[0], [0; 200]);
> +    /// # Ok::<(), Error>(())
> +    /// ```
> +    pub fn push_init(&mut self, init: impl Init<T>, flags: Flags) -> 
> Result<(), AllocError> {

[Severity: Low]
This isn't a bug, but should this abstraction wrapper include an #[inline]
annotation?

The push_init function is a small wrapper in the kernel abstraction crate
that simply forwards to try_push_init and maps the error. The Rust
subsystem guidelines mandate that small functions in abstraction crates
should be annotated with #[inline].

> +        self.try_push_init(init, flags)
> +            .map_err(|PushInitError::AllocError(_)| AllocError)
> +    }

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

Reply via email to