drm: fix drm_get_max_iomem type mismatch

Submitted by Arnd Bergmann on Feb. 22, 2018, 11:47 a.m.

Details

Message ID 20180222114804.1394300-1-arnd@arndb.de
State New
Headers show
Series "drm: fix drm_get_max_iomem type mismatch" ( rev: 1 ) in DRI devel

Not browsing as part of any series.

Commit Message

Arnd Bergmann Feb. 22, 2018, 11:47 a.m.
When comparing two variables with min()/max(), they should be the same type:

drivers/gpu/drm/drm_memory.c: In function 'drm_get_max_iomem':
include/linux/kernel.h:821:16: error: comparison of distinct pointer types lacks a cast [-Werror]
  (void) (&max1 == &max2);

This makes the local variable in drm_get_max_iomem make the type
from resource->end.

Fixes: 82626363a217 ("drm: add func to get max iomem address v2")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/drm_memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c
index 7ca500b8c399..3c54044214db 100644
--- a/drivers/gpu/drm/drm_memory.c
+++ b/drivers/gpu/drm/drm_memory.c
@@ -153,7 +153,7 @@  EXPORT_SYMBOL(drm_legacy_ioremapfree);
 u64 drm_get_max_iomem(void)
 {
 	struct resource *tmp;
-	u64 max_iomem = 0;
+	resource_size_t max_iomem = 0;
 
 	for (tmp = iomem_resource.child; tmp; tmp = tmp->sibling) {
 		max_iomem = max(max_iomem,  tmp->end);

Comments

On Thu, Feb 22, 2018 at 12:47:51PM +0100, Arnd Bergmann wrote:
> When comparing two variables with min()/max(), they should be the same type:
> 
> drivers/gpu/drm/drm_memory.c: In function 'drm_get_max_iomem':
> include/linux/kernel.h:821:16: error: comparison of distinct pointer types lacks a cast [-Werror]
>   (void) (&max1 == &max2);
> 
> This makes the local variable in drm_get_max_iomem make the type
> from resource->end.
> 
> Fixes: 82626363a217 ("drm: add func to get max iomem address v2")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks Arnd, I've applied this to drm-misc-next.

Sean

> ---
>  drivers/gpu/drm/drm_memory.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c
> index 7ca500b8c399..3c54044214db 100644
> --- a/drivers/gpu/drm/drm_memory.c
> +++ b/drivers/gpu/drm/drm_memory.c
> @@ -153,7 +153,7 @@ EXPORT_SYMBOL(drm_legacy_ioremapfree);
>  u64 drm_get_max_iomem(void)
>  {
>  	struct resource *tmp;
> -	u64 max_iomem = 0;
> +	resource_size_t max_iomem = 0;
>  
>  	for (tmp = iomem_resource.child; tmp; tmp = tmp->sibling) {
>  		max_iomem = max(max_iomem,  tmp->end);
> -- 
> 2.9.0
>