[PATCH 1/2] drm/i915/gem: Return -EINVAL instead of '0'

Andi Shyti andi.shyti at linux.intel.com
Mon Jun 17 14:22:11 UTC 2024


On Mon, Jun 17, 2024 at 07:55:10AM -0500, Lucas De Marchi wrote:
> On Sun, Jun 16, 2024 at 09:03:48AM GMT, Andi Shyti wrote:
> > Commit 05da7d9f717b ("drm/i915/gem: Downgrade stolen lmem setup
> > warning") returns '0' from i915_gem_stolen_lmem_setup(), but it's
> > supposed to return a pointer to the intel_memory_region
> > structure.
> > 
> > Sparse complains with the following message:
> > 
> > > > drivers/gpu/drm/i915/gem/i915_gem_stolen.c:943:32: sparse: sparse:
> >   Using plain integer as NULL pointer
> > 
> > The caller checks for errors, and if no error is returned, it
> > stores the address of the stolen memory. Therefore, we can't
> > return NULL. Since we are handling a case of out-of-bounds, it's
> > appropriate to treat the "lmem_size < dsm_base" case as an error.
> 
> which completely invalidates the point of the commit that introduced this
> regression. That was commit was supposed to do "let's continue, just
> disabling stolen". 

Yes, correct, I missed the point while fixing stuff. But patch 2
is still valid.

Thanks,
Andi


More information about the Intel-gfx mailing list