diff mbox series

[v2,1/5] drm/etnaviv: Use unsigned type to count the number of pages

Message ID 20240908121107.328740-1-sui.jingfeng@linux.dev (mailing list archive)
State New, archived
Headers show
Series [v2,1/5] drm/etnaviv: Use unsigned type to count the number of pages | expand

Commit Message

Sui Jingfeng Sept. 8, 2024, 12:11 p.m. UTC
The drm_prime_pages_to_sg() function takes an 'unsigned int' argument to
store the length of the page vector. The size of the object in number of
CPU pages can not be negative, hence, use 'unsigned' variable to store
the number of pages, instead of the 'signed' one.

Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
---

v2: Pick up tags and improve commit message

 drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lucas Stach Oct. 28, 2024, 3:54 p.m. UTC | #1
Am Sonntag, dem 08.09.2024 um 20:11 +0800 schrieb Sui Jingfeng:
> The drm_prime_pages_to_sg() function takes an 'unsigned int' argument to
> store the length of the page vector. The size of the object in number of
> CPU pages can not be negative, hence, use 'unsigned' variable to store
> the number of pages, instead of the 'signed' one.
> 
> Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
> Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>

Thanks, series applied to etnaviv/next.

> ---
> 
> v2: Pick up tags and improve commit message
> 
>  drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
> index 3524b5811682..6b98200068e4 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
> @@ -17,7 +17,7 @@ static struct lock_class_key etnaviv_prime_lock_class;
>  struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj)
>  {
>  	struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
> -	int npages = obj->size >> PAGE_SHIFT;
> +	unsigned int npages = obj->size >> PAGE_SHIFT;
>  
>  	if (WARN_ON(!etnaviv_obj->pages))  /* should have already pinned! */
>  		return ERR_PTR(-EINVAL);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
index 3524b5811682..6b98200068e4 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
@@ -17,7 +17,7 @@  static struct lock_class_key etnaviv_prime_lock_class;
 struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj)
 {
 	struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
-	int npages = obj->size >> PAGE_SHIFT;
+	unsigned int npages = obj->size >> PAGE_SHIFT;
 
 	if (WARN_ON(!etnaviv_obj->pages))  /* should have already pinned! */
 		return ERR_PTR(-EINVAL);