diff mbox series

[v2,1/2] drm/i915/gem: Return NULL instead of '0'

Message ID 20240617184243.330231-2-andi.shyti@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series Sparse errors on the i915_gem_stolen | expand

Commit Message

Andi Shyti June 17, 2024, 6:42 p.m. UTC
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

Return NULL.

Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Jonathan Cavitt <jonathan.cavitt@intel.com>
---
Cc: Lucas De Marchi <lucas.demarchi@intel.com>

 drivers/gpu/drm/i915/gem/i915_gem_stolen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lucas De Marchi June 27, 2024, 1:28 p.m. UTC | #1
On Mon, Jun 17, 2024 at 08:42:42PM 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
>
>Return NULL.
>
>Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
>Cc: Jonathan Cavitt <jonathan.cavitt@intel.com>
>---
>Cc: Lucas De Marchi <lucas.demarchi@intel.com>

Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>

thanks
Lucas De Marchi

>
> drivers/gpu/drm/i915/gem/i915_gem_stolen.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
>index 004471f60117..9ca73936dc5e 100644
>--- a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
>+++ b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
>@@ -940,7 +940,7 @@ i915_gem_stolen_lmem_setup(struct drm_i915_private *i915, u16 type,
> 			drm_dbg(&i915->drm,
> 				"Disabling stolen memory support due to OOB placement: lmem_size = %lli vs dsm_base = %lli\n",
> 				lmem_size, dsm_base);
>-			return 0;
>+			return NULL;
> 		}
> 		dsm_size = ALIGN_DOWN(lmem_size - dsm_base, SZ_1M);
> 	}
>-- 
>2.45.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
index 004471f60117..9ca73936dc5e 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
@@ -940,7 +940,7 @@  i915_gem_stolen_lmem_setup(struct drm_i915_private *i915, u16 type,
 			drm_dbg(&i915->drm,
 				"Disabling stolen memory support due to OOB placement: lmem_size = %lli vs dsm_base = %lli\n",
 				lmem_size, dsm_base);
-			return 0;
+			return NULL;
 		}
 		dsm_size = ALIGN_DOWN(lmem_size - dsm_base, SZ_1M);
 	}