[PATCH 2/2] drm/i915: Fix incorrect error handling in shmem_pwrite()
Andi Shyti
andi.shyti at kernel.org
Wed Aug 20 17:03:44 UTC 2025
Hi Rodrigo,
...
> > @@ -441,12 +441,12 @@ shmem_pwrite(struct drm_i915_gem_object *obj,
> > written = file->f_op->write_iter(&kiocb, &iter);
> > BUG_ON(written == -EIOCBQUEUED);
> >
> > - if (written != size)
> > - return -EIO;
> > -
> > if (written < 0)
> > return written;
> >
> > + if (written != size)
> > + return -EIO;
>
> That's awkward...
>
> I mean, you are right that we cannot overwrite what is returned from the
> write_iter function. But perhaps this != check here should be before?
>
> Or it at least deserves a comment in the code telling what's the intent
> here. why != size is -EIO... but it was already written :/
The check (written < 0) is completely useless after (written !=
size), so that I think the patch is correct.
Andi
> > +
> > return 0;
> > }
> >
> > --
> > 2.34.1
More information about the Intel-gfx
mailing list