lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <D8JTUPQ28758.2SKKTA6IL6Y8E@proton.me>
Date: Wed, 19 Mar 2025 00:48:00 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Daniel Almeida <daniel.almeida@...labora.com>, Danilo Krummrich <dakr@...nel.org>
Cc: 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>, Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Rafael J. Wysocki" <rafael@...nel.org>, linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v7 3/3] rust: platform: allow ioremap of platform resources

On Tue Mar 18, 2025 at 7:22 PM CET, Daniel Almeida wrote:
> On 18 Mar 2025, at 14:43, Danilo Krummrich <dakr@...nel.org> wrote:
>> On Tue, Mar 18, 2025 at 02:20:43PM -0300, Daniel Almeida wrote:
>>> +    ///     // Read and write a 32-bit value at `offset`. Calling `try_access()` on
>>> +    ///     // the `Devres` makes sure that the resource is still valid.
>>> +    ///     let data = iomem.try_access().ok_or(ENODEV)?.readl(offset);
>>> +    ///
>>> +    ///     iomem.try_access().ok_or(ENODEV)?.writel(data, offset);
>> 
>> I'd probably write this as
>> 
>> || -> Result {
>> let iomem = iomem.try_access().ok_or(ENODEV)?;
>> 
>> iomem.read32(offset);
>> iomem.write32(data, offset);
>> 
>> Ok(())
>> }()?;

Why use a closure here?

---
Cheers,
Benno


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ