Skip to contentSkip to conversation

drm: drm_memory: fix compiler warning on 32-bit targets

PATCH In review David Lechner 2 participants 2 messages Feb 19, 2018 – Feb 20, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm: drm_memory: fix compiler warning on 32-bit targets

The end field of struct resource is resource_size_t, so on 32-bit targets, this is a 32-bit value. This results in a compiler warning of "warning: comparison of distinct pointer types lacks a cast". Fix it by making max_iomem resource_size_t to match the end field.

Fixes (82626363a217 "drm: add func to get max iomem address v2")
---
 drivers/gpu/drm/drm_memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_memory.c +1 -1
index 7ca500b..3c54044 100644
@@ -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);
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v2 1/1
#1 lore raw
Quoted 2 lines · David Lechner

The end field of struct resource is resource_size_t, so on 32-bit targets, this is a 32-bit value.

That's not quite correct. resource_size_t is a phys_addr_t, which can be 64-bit also on 32-bit targets (if they've got CONFIG_PHYS_ADDR_T_64BIT enabled, which is used for example with PAE).

With that fixed:

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel