[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <D91LB39LUIG6.1P7MMHZ6YHSMA@proton.me>
Date: Tue, 08 Apr 2025 21:54:13 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Andreas Hindborg <a.hindborg@...nel.org>, Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Abdiel Janulgue <abdiel.janulgue@...il.com>, ojeda@...nel.org, Danilo Krummrich <dakr@...nel.org>, Daniel Almeida <daniel.almeida@...labora.com>, Robin Murphy <robin.murphy@....com>, 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>, Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, "open list:DMA MAPPING HELPERS DEVICE DRIVER API [RUST]" <rust-for-linux@...r.kernel.org>, Marek Szyprowski <m.szyprowski@...sung.com>, "open list:DMA MAPPING HELPERS" <iommu@...ts.linux.dev>, open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/3] rust: dma: convert the read/write macros to return Result
On Tue Apr 8, 2025 at 9:46 PM CEST, Andreas Hindborg wrote:
> "Miguel Ojeda" <miguel.ojeda.sandonis@...il.com> writes:
>> On Tue, Apr 8, 2025 at 2:40 PM Andreas Hindborg <a.hindborg@...nel.org> wrote:
>>>
>>> But the `assert_eq!` would panic anyway if comparison fails, right?
>>
>> Previously the `?` generated by the macro would return out of the
>> closure written by the sample, and thus it wouldn't reach the
>> `assert_eq!`.
>
> Right, I see. So the question is whether we want to have the assert
> panic here or not, of we get an Err. I vote yes.
The assert wouldn't be the source of the panic though, it would be the
`.unwrap()`, but I think it's better to report the error. Although I
think it would be nicer if the example could use better error handling,
but this code is in a `drop` function, so no way to bubble up a
result...
---
Cheers,
Benno
Powered by blists - more mailing lists