dri-devel Archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] drm/nouveau/disp: fix incompatible types in subtraction
@ 2023-08-05 10:16 Chen Jiahao
  0 siblings, 0 replies; only message in thread
From: Chen Jiahao @ 2023-08-05 10:16 UTC (permalink / raw
  To: bskeggs, kherbst, lyude, airlied, daniel, jani.nikula, Wayne.Lin,
	ruanjinjie, dri-devel, nouveau
  Cc: chenjiahao16

This patch fixes the following sparse error:

drivers/gpu/drm/nouveau/dispnv50/disp.c:134:31: error: subtraction of different types can't work (different address spaces)
drivers/gpu/drm/nouveau/dispnv50/disp.c:197:31: error: subtraction of different types can't work (different address spaces)

In struct nvif_push, "cur" is of type u32 *, whereas
dmac->_push.mem.object.map.ptr is of type void __iomem *.
Converting push->cur to u32 __iomem * to fix above sparse
error.

Fixes: 9cf06d6ef7fd ("drm/nouveau/disp: fix cast removes address space of expression warnings")
Signed-off-by: Chen Jiahao <chenjiahao16@huawei.com>
---
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 4e7c9c353c51..3e95d82ce900 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -131,7 +131,7 @@ nv50_dmac_kick(struct nvif_push *push)
 {
 	struct nv50_dmac *dmac = container_of(push, typeof(*dmac), _push);
 
-	dmac->cur = push->cur - (u32 __iomem *)dmac->_push.mem.object.map.ptr;
+	dmac->cur = (u32 __iomem *)push->cur - (u32 __iomem *)dmac->_push.mem.object.map.ptr;
 	if (dmac->put != dmac->cur) {
 		/* Push buffer fetches are not coherent with BAR1, we need to ensure
 		 * writes have been flushed right through to VRAM before writing PUT.
@@ -194,7 +194,7 @@ nv50_dmac_wait(struct nvif_push *push, u32 size)
 	if (WARN_ON(size > dmac->max))
 		return -EINVAL;
 
-	dmac->cur = push->cur - (u32 __iomem *)dmac->_push.mem.object.map.ptr;
+	dmac->cur = (u32 __iomem *)push->cur - (u32 __iomem *)dmac->_push.mem.object.map.ptr;
 	if (dmac->cur + size >= dmac->max) {
 		int ret = nv50_dmac_wind(dmac);
 		if (ret)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-05 10:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-05 10:16 [PATCH -next] drm/nouveau/disp: fix incompatible types in subtraction Chen Jiahao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).