[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72ne57qiwgWSDE=C1bvBuYGsUg9f8PooM+V_nZFo1Z5ogQ@mail.gmail.com>
Date: Sun, 2 Mar 2025 07:54:00 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Miguel Ojeda <ojeda@...nel.org>
Cc: Jocelyn Falempe <jfalempe@...hat.com>, Thomas Böhler <witcher@...edspace.de>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Alex Gaynor <alex.gaynor@...il.com>, dri-devel@...ts.freedesktop.org,
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>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org, patches@...ts.linux.dev
Subject: Re: [PATCH 1/2] drm/panic: use `div_ceil` to clean Clippy warning
On Sun, Mar 2, 2025 at 12:17 AM Miguel Ojeda <ojeda@...nel.org> wrote:
>
> Starting with the upcoming Rust 1.86.0 (to be released 2025-04-03),
> Clippy warns:
>
> error: manually reimplementing `div_ceil`
> --> drivers/gpu/drm/drm_panic_qr.rs:548:26
> |
> 548 | let pad_offset = (offset + 7) / 8;
> | ^^^^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `offset.div_ceil(8)`
> |
> = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil
>
> And similarly for `stride`. Thus apply the suggestion to both.
>
> The behavior (and thus codegen) is not exactly equivalent [1][2], since
> `div_ceil()` returns the right value for the values that currently
> would overflow.
>
> Link: https://github.com/rust-lang/rust-clippy/issues/14333 [1]
> Link: https://godbolt.org/z/dPq6nGnv3 [2]
> Signed-off-by: Miguel Ojeda <ojeda@...nel.org>
Cc: stable@...r.kernel.org # Needed in 6.12.y and 6.13.y only (Rust is
pinned in older LTSs).
Cheers,
Miguel
Powered by blists - more mailing lists