Skip to contentSkip to conversation

drm/nouveau: avoid -Wtautological-constant-out-of-range-compare warning

PATCH New Arnd Bergmann 1 participant 1 message Mar 6

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

PATCH 1/1 drm/nouveau: avoid -Wtautological-constant-out-of-range-compare warning

From: Arnd Bergmann <[email protected]>

Checking a large 64-bit constant against a 32-bit dma_addr_t produces a harmless compiler output when extra warnings are enabled, but leads to a build failure with -Werror:

drivers/gpu/drm/nouveau/nvkm/subdev/fb/gb202.c:17:37: error: result of comparison of constant 4503599627370495 with expression of type 'dma_addr_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
17 | WARN_ON(fb->sysmem.flush_page_addr > DMA_BIT_MASK(52));

As the calculations of sysmem.flush_page_addr are mostly done on u64 types anyway, change the struct member to the same type. This feels less invasive than changing each WARN_ON() to add an extra cast or extended condition to shut up the warning.

Fixes 31d3354f42c0 ("drm/nouveau: verify that hardware supports the flush page address")
---
 drivers/gpu/drm/nouveau/include/nvkm/subdev/fb.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/include/nvkm/subdev/fb.h +1 -1
index e0d777a933e1..7b932449606b 100644
@@ -38,7 +38,7 @@ struct nvkm_fb {
 
 	struct {
 		struct page *flush_page;
-		dma_addr_t flush_page_addr;
+		u64 flush_page_addr;
 	} sysmem;
 
 	struct nvkm_ram *ram;
Signature · 1 line
2.39.5