[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ca6ed5c1-5b39-4e22-8294-88380885bb65@sirena.org.uk>
Date: Mon, 19 May 2025 13:46:55 +0100
From: Mark Brown <broonie@...nel.org>
To: Benno Lossin <lossin@...nel.org>
Cc: Alexandre Courbot <acourbot@...dia.com>,
Daniel Almeida <daniel.almeida@...labora.com>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>,
Boris Brezillon <boris.brezillon@...labora.com>,
Sebastian Reichel <sebastian.reichel@...labora.com>,
Liam Girdwood <lgirdwood@...il.com>, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v3] rust: regulator: add a bare minimum regulator
abstraction
On Mon, May 19, 2025 at 02:30:05PM +0200, Benno Lossin wrote:
> On Mon May 19, 2025 at 1:46 PM CEST, Mark Brown wrote:
> > If you don't disable the regulator you've just leaked a reference which
> > is obviously a problem.
> For sure. But I'm trying to figure out if this is a safety-related issue
> or not. Safety in Rust has a rather specific meaning that can be
> summarized with "no UB". So since the C side does nothing if the user
> screwed up the refcounts, it lets me to believe that we don't have any
> safety related issues when forgetting to call `regulator_disable`.
> Of course we still should strive for an API that makes that impossible
> or at least very hard, but we don't need to make the API `unsafe` or
> have to take special care. (At least if I understood correctly)
Yes, it's relatively unlikely that it would lead to any undefined
behaviour. There is an API for crashing through the refcounts and
disabling if we detect some emergency, but that's very extreme.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists