gpu: host1x: Fix compiler errors

Message ID 20180326144314.xeuocqp5fjpfjm3q@lianli
State New
Headers show
Series
  • gpu: host1x: Fix compiler errors
Related show

Commit Message

Emil Goode March 26, 2018, 2:44 p.m.
The compiler is complaining with the following errors:

drivers/gpu/host1x/cdma.c:94:48: error:
	passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type
	[-Werror=incompatible-pointer-types]

drivers/gpu/host1x/cdma.c:113:48: error:
	passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type
	[-Werror=incompatible-pointer-types]

The expected pointer type of the third argument to dma_alloc_wc() is
dma_addr_t but phys_addr_t is passed. Fix this by adding casts to the
expected pointer type.

Signed-off-by: Emil Goode <emil.fsw@goode.io>
---
 drivers/gpu/host1x/cdma.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Thierry Reding March 26, 2018, 2:57 p.m. | #1
On Mon, Mar 26, 2018 at 04:44:14PM +0200, Emil Goode wrote:
> The compiler is complaining with the following errors:
> 
> drivers/gpu/host1x/cdma.c:94:48: error:
> 	passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type
> 	[-Werror=incompatible-pointer-types]
> 
> drivers/gpu/host1x/cdma.c:113:48: error:
> 	passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type
> 	[-Werror=incompatible-pointer-types]
> 
> The expected pointer type of the third argument to dma_alloc_wc() is
> dma_addr_t but phys_addr_t is passed. Fix this by adding casts to the
> expected pointer type.
> 
> Signed-off-by: Emil Goode <emil.fsw@goode.io>
> ---
>  drivers/gpu/host1x/cdma.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

What compiler do you use? I do regular builds and check for warnings and
errors, and this one is new to me.

Thierry

> 
> diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
> index 28541b280739..5e8b321a751e 100644
> --- a/drivers/gpu/host1x/cdma.c
> +++ b/drivers/gpu/host1x/cdma.c
> @@ -91,8 +91,8 @@ static int host1x_pushbuffer_init(struct push_buffer *pb)
>  
>  		size = iova_align(&host1x->iova, size);
>  
> -		pb->mapped = dma_alloc_wc(host1x->dev, size, &pb->phys,
> -					  GFP_KERNEL);
> +		pb->mapped = dma_alloc_wc(host1x->dev, size,
> +					  (dma_addr_t *)&pb->phys, GFP_KERNEL);
>  		if (!pb->mapped)
>  			return -ENOMEM;
>  
> @@ -110,8 +110,8 @@ static int host1x_pushbuffer_init(struct push_buffer *pb)
>  		if (err)
>  			goto iommu_free_iova;
>  	} else {
> -		pb->mapped = dma_alloc_wc(host1x->dev, size, &pb->phys,
> -					  GFP_KERNEL);
> +		pb->mapped = dma_alloc_wc(host1x->dev, size,
> +					  (dma_addr_t *)&pb->phys, GFP_KERNEL);
>  		if (!pb->mapped)
>  			return -ENOMEM;
>  
> -- 
> 2.11.0
>
Emil Goode March 26, 2018, 3:47 p.m. | #2
Hello,

On Mon, Mar 26, 2018 at 04:57:34PM +0200, Thierry Reding wrote:
> On Mon, Mar 26, 2018 at 04:44:14PM +0200, Emil Goode wrote:
> > The compiler is complaining with the following errors:
> > 
> > drivers/gpu/host1x/cdma.c:94:48: error:
> > 	passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type
> > 	[-Werror=incompatible-pointer-types]
> > 
> > drivers/gpu/host1x/cdma.c:113:48: error:
> > 	passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type
> > 	[-Werror=incompatible-pointer-types]
> > 
> > The expected pointer type of the third argument to dma_alloc_wc() is
> > dma_addr_t but phys_addr_t is passed. Fix this by adding casts to the
> > expected pointer type.
> > 
> > Signed-off-by: Emil Goode <emil.fsw@goode.io>
> > ---
> >  drivers/gpu/host1x/cdma.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> What compiler do you use? I do regular builds and check for warnings and
> errors, and this one is new to me.
> 
> Thierry
>

I use gcc version 6.3.0 cross compiler for armhf supplied with Debian Stretch.

Best regards,

Emil

> > 
> > diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
> > index 28541b280739..5e8b321a751e 100644
> > --- a/drivers/gpu/host1x/cdma.c
> > +++ b/drivers/gpu/host1x/cdma.c
> > @@ -91,8 +91,8 @@ static int host1x_pushbuffer_init(struct push_buffer *pb)
> >  
> >  		size = iova_align(&host1x->iova, size);
> >  
> > -		pb->mapped = dma_alloc_wc(host1x->dev, size, &pb->phys,
> > -					  GFP_KERNEL);
> > +		pb->mapped = dma_alloc_wc(host1x->dev, size,
> > +					  (dma_addr_t *)&pb->phys, GFP_KERNEL);
> >  		if (!pb->mapped)
> >  			return -ENOMEM;
> >  
> > @@ -110,8 +110,8 @@ static int host1x_pushbuffer_init(struct push_buffer *pb)
> >  		if (err)
> >  			goto iommu_free_iova;
> >  	} else {
> > -		pb->mapped = dma_alloc_wc(host1x->dev, size, &pb->phys,
> > -					  GFP_KERNEL);
> > +		pb->mapped = dma_alloc_wc(host1x->dev, size,
> > +					  (dma_addr_t *)&pb->phys, GFP_KERNEL);
> >  		if (!pb->mapped)
> >  			return -ENOMEM;
> >  
> > -- 
> > 2.11.0
> > 


--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
index 28541b280739..5e8b321a751e 100644
--- a/drivers/gpu/host1x/cdma.c
+++ b/drivers/gpu/host1x/cdma.c
@@ -91,8 +91,8 @@  static int host1x_pushbuffer_init(struct push_buffer *pb)
 
 		size = iova_align(&host1x->iova, size);
 
-		pb->mapped = dma_alloc_wc(host1x->dev, size, &pb->phys,
-					  GFP_KERNEL);
+		pb->mapped = dma_alloc_wc(host1x->dev, size,
+					  (dma_addr_t *)&pb->phys, GFP_KERNEL);
 		if (!pb->mapped)
 			return -ENOMEM;
 
@@ -110,8 +110,8 @@  static int host1x_pushbuffer_init(struct push_buffer *pb)
 		if (err)
 			goto iommu_free_iova;
 	} else {
-		pb->mapped = dma_alloc_wc(host1x->dev, size, &pb->phys,
-					  GFP_KERNEL);
+		pb->mapped = dma_alloc_wc(host1x->dev, size,
+					  (dma_addr_t *)&pb->phys, GFP_KERNEL);
 		if (!pb->mapped)
 			return -ENOMEM;