On Thu, Dec 18, 2025 at 10:16:48PM +0900, Alexandre Courbot wrote:
> On Mon Dec 15, 2025 at 5:34 PM JST, Brendan Shephard wrote:
> > impl NovaObject {
> > /// Create a new DRM GEM object.
> > pub(crate) fn new(dev: &NovaDevice, size: usize) ->
> > Result<ARef<gem::Object<Self>>> {
> > - let aligned_size = size.next_multiple_of(1 << 12);
> > -
> > - if size == 0 || size > aligned_size {
> > + if size == 0 {
> > return Err(EINVAL);
> > }
> > + let aligned_size = page_align(size).ok_or(EINVAL)?;
>
> nit, but it's a good practice to always leave an empty line before a
> block of variable declarations.
>
> >
> > gem::Object::new(dev, aligned_size)
>
> ... or if you prefer to avoid the variable altogether:
>
> page_align(size)
> .ok_or(EINVAL)
> .and_then(|size| gem::Object::new(dev, size))
>
Sounds good, I'll use `and_then`. I like the idea of not unnecessarily
assigning variables just to use them once. I'll make that change, re-test
and send a new revision of this one.
Thanks!