Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Copy-paste error in SAFETY comments for `I2cAdapter` and `I2cClient`. --
commit c7fe859c40ffae9a22f5e5fa80c3b5a426e7197d Author: Oliver Mangold <[email protected]> rust: rename AlwaysRefCounted to RefCounted. This commit splits the AlwaysRefCounted trait into RefCounted and a new marker trait AlwaysRefCounted. This prevents the unsound creation of an ARef<T> from an &Owned<T> when types can be either reference counted or owned. > diff --git a/rust/kernel/i2c.rs b/rust/kernel/i2c.rs > index 624b971ca8b0b..02b2c9220eb11 100644 > --- a/rust/kernel/i2c.rs > +++ b/rust/kernel/i2c.rs [ ... ] > @@ -435,6 +436,9 @@ unsafe fn dec_ref(obj: NonNull<Self>) { > unsafe { bindings::i2c_put_adapter(obj.as_ref().as_raw()) } > } > } > +// SAFETY: We do not implement `Ownable`, thus it is okay to obtain an > `ARef<Device>` from an > +// `&I2cAdapter`. > +unsafe impl AlwaysRefCounted for I2cAdapter {} [Severity: Low] This isn't a bug, but should this SAFETY comment refer to ARef<I2cAdapter> instead of ARef<Device>? It appears to be a typo from copying the Device implementation. [ ... ] > @@ -511,6 +515,9 @@ unsafe fn dec_ref(obj: NonNull<Self>) { > unsafe { bindings::put_device(&raw mut (*obj.as_ref().as_raw()).dev) > } > } > } > +// SAFETY: We do not implement `Ownable`, thus it is okay to obtain an > `ARef<Device>` from an > +// `&I2cClient`. > +unsafe impl AlwaysRefCounted for I2cClient {} [Severity: Low] This isn't a bug either, but is ARef<Device> also a typo here? It looks like it should refer to ARef<I2cClient>. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=5
