[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aFglHG6lK0a94SIu@pollux>
Date: Sun, 22 Jun 2025 17:45:32 +0200
From: Danilo Krummrich <dakr@...nel.org>
To: Benno Lossin <lossin@...nel.org>
Cc: gregkh@...uxfoundation.org, rafael@...nel.org, ojeda@...nel.org,
alex.gaynor@...il.com, boqun.feng@...il.com, gary@...yguo.net,
bjorn3_gh@...tonmail.com, benno.lossin@...ton.me,
a.hindborg@...nel.org, aliceryhl@...gle.com, tmgross@...ch.edu,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] rust: devres: get rid of Devres' inner Arc
On Sun, Jun 22, 2025 at 09:05:51AM +0200, Benno Lossin wrote:
> On Thu Jun 12, 2025 at 4:51 PM CEST, Danilo Krummrich wrote:
> > + fn remove_action(&self) -> bool {
> > + // SAFETY:
> > + // - `self.dev` is a valid `Device`,
> > + // - the `action` and `data` pointers are the exact same ones as given to devm_add_action()
> > + // previously,
> > + // - `self` is always valid, even if the action has been released already.
> > + (unsafe {
> > + bindings::devm_remove_action_nowarn(
> > + self.dev.as_raw(),
> > + Some(self.callback),
> > + self.as_ptr().cast_mut().cast(),
> > + )
> > + } == 0)
>
> I don't think the parenthesis are required?
At least the compiler doesn't seem to be happy about removing them:
error: expected expression, found `==`
--> rust/kernel/devres.rs:199:11
|
199 | } == 0
| ^^ expected expression
error[E0308]: mismatched types
--> rust/kernel/devres.rs:194:13
|
194 | / bindings::devm_remove_action_nowarn(
195 | | self.dev.as_raw(),
196 | | Some(self.callback),
197 | | self.inner().as_ptr().cast_mut().cast(),
198 | | )
| | ^- help: consider using a semicolon here: `;`
| |_____________|
| expected `()`, found `i32`
error: aborting due to 2 previous errors
Powered by blists - more mailing lists