Skip to contentSkip to conversation

fix gpu/drm/nouveau: fix return type in nouveau_dmem_migrate_to_ram()

PATCH In review Balbir Singh 2 participants 6 messages Nov 13, 2025 – Nov 14, 2025

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

PATCH 1/1 fix gpu/drm/nouveau: fix return type in nouveau_dmem_migrate_to_ram()

ret of type vm_fault_t is reused to capture the return value of nouveau_dmem_copy_folio(), which returns an int. Use a new copy_ret to fix the issue. The issue is not new, prior to this the function called was called nouveau_dmem_copy_one() and ret was used to capture it's value.

Cc Andrew Morton <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Zi Yan <[email protected]>
Cc Joshua Hahn <[email protected]>
Cc Rakie Kim <[email protected]>
Cc Byungchul Park <[email protected]>
Cc Gregory Price <[email protected]>
Cc Ying Huang <[email protected]>
Cc Alistair Popple <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Baolin Wang <[email protected]>
Cc "Liam R. Howlett" <[email protected]>
Cc Nico Pache <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Dev Jain <[email protected]>
Cc Barry Song <[email protected]>
Cc Lyude Paul <[email protected]>
Cc Danilo Krummrich <[email protected]>
Cc David Airlie <[email protected]>
Cc Simona Vetter <[email protected]>
Cc Ralph Campbell <[email protected]>
Cc Mika Penttilä <[email protected]>
Cc Matthew Brost <[email protected]>
Cc Francois Dugast <[email protected]>
---
 drivers/gpu/drm/nouveau/nouveau_dmem.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nouveau_dmem.c +3 -2
index 244812e7dd69..06f2c544c2cb 100644
@@ -188,6 +188,7 @@ static vm_fault_t nouveau_dmem_migrate_to_ram(struct vm_fault *vmf)
 	struct nouveau_svmm *svmm;
 	struct page *dpage;
 	vm_fault_t ret = 0;
+	int copy_ret;
 	struct migrate_vma args = {
 		.vma		= vmf->vma,
 		.pgmap_owner	= drm->dev,
@@ -256,9 +257,9 @@ static vm_fault_t nouveau_dmem_migrate_to_ram(struct vm_fault *vmf)
 	svmm = folio_zone_device_data(sfolio);
 	mutex_lock(&svmm->mutex);
 	nouveau_svmm_invalidate(svmm, args.start, args.end);
-	ret = nouveau_dmem_copy_folio(drm, sfolio, dfolio, &dma_info);
+	copy_ret = nouveau_dmem_copy_folio(drm, sfolio, dfolio, &dma_info);
 	mutex_unlock(&svmm->mutex);
-	if (ret) {
+	if (copy_ret) {
 		ret = VM_FAULT_SIGBUS;
 		goto done;
 	}
Signature · 1 line
2.51.1
#1 lore raw
Quoted 8 lines · Balbir Singh

ret of type vm_fault_t is reused to capture the return value of nouveau_dmem_copy_folio(), which returns an int. Use a new copy_ret to fix the issue. The issue is not new, prior to this the function called was called nouveau_dmem_copy_one() and ret was used to capture it's value.

It's a sparse warning, is there any runtime effect?

Quoted 18 lines
Cc Andrew Morton <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Zi Yan <[email protected]>
Cc Joshua Hahn <[email protected]>
Cc Rakie Kim <[email protected]>
Cc Byungchul Park <[email protected]>
Cc Gregory Price <[email protected]>
Cc Ying Huang <[email protected]>
Cc Alistair Popple <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Baolin Wang <[email protected]>
Cc "Liam R. Howlett" <[email protected]>
Cc Nico Pache <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Dev Jain <[email protected]>
Cc Barry Song <[email protected]>
Quoted 9 lines
Cc Lyude Paul <[email protected]>
Cc Danilo Krummrich <[email protected]>
Cc David Airlie <[email protected]>
Cc Simona Vetter <[email protected]>
Cc Ralph Campbell <[email protected]>
Cc Mika Penttilä <[email protected]>
Cc Matthew Brost <[email protected]>
Cc Francois Dugast <[email protected]>
Fixes ? Or is does this just fix a sparse warning and nothing "real" we could run into and cause problems?
Signature · 3 lines
Cheers

David
#2 lore raw
Quoted 7 lines · David Hildenbrand (Red Hat)
Quoted 6 lines · Balbir Singh

ret of type vm_fault_t is reused to capture the return value of nouveau_dmem_copy_folio(), which returns an int. Use a new copy_ret to fix the issue. The issue is not new, prior to this the function called was called nouveau_dmem_copy_one() and ret was used to capture it's value.

Quoted 5 lines
Quoted 2 lines

It's a sparse warning, is there any runtime effect?

No impact really, it's just a sparse warning

Quoted 28 lines
Quoted 18 lines
Cc Andrew Morton <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Zi Yan <[email protected]>
Cc Joshua Hahn <[email protected]>
Cc Rakie Kim <[email protected]>
Cc Byungchul Park <[email protected]>
Cc Gregory Price <[email protected]>
Cc Ying Huang <[email protected]>
Cc Alistair Popple <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Baolin Wang <[email protected]>
Cc "Liam R. Howlett" <[email protected]>
Cc Nico Pache <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Dev Jain <[email protected]>
Cc Barry Song <[email protected]>
Quoted 9 lines
Cc Lyude Paul <[email protected]>
Cc Danilo Krummrich <[email protected]>
Cc David Airlie <[email protected]>
Cc Simona Vetter <[email protected]>
Cc Ralph Campbell <[email protected]>
Cc Mika Penttilä <[email protected]>
Cc Matthew Brost <[email protected]>
Cc Francois Dugast <[email protected]>
Quoted 3 lines
Fixes ? Or is does this just fix a sparse warning and nothing "real" we could run into and cause problems?

There is no "real" impact, it's a warning about the type mismatch. The return value is checked as a boolean. There is no need to backport to stable, IMHO

Balbir

#3 lore raw
Quoted 8 lines · Balbir Singh
Quoted 7 lines · David Hildenbrand (Red Hat)
Quoted 6 lines · Balbir Singh

ret of type vm_fault_t is reused to capture the return value of nouveau_dmem_copy_folio(), which returns an int. Use a new copy_ret to fix the issue. The issue is not new, prior to this the function called was called nouveau_dmem_copy_one() and ret was used to capture it's value.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

It's a sparse warning, is there any runtime effect?

No impact really, it's just a sparse warning

Okay, then please

1) Make that clear in the patch description

2) Make that clear in the patch subject.

In particular, the current subject is weird. Should probably be

"nouveau/dmem: fix sparse warning in nouveau_dmem_migrate_to_ram()"

Change itself LGTM, although I would probably call it "int err" or something like that instead.

Signature · 3 lines
Cheers

David
#4 lore raw
Quoted 19 lines · David Hildenbrand (Red Hat)
Quoted 8 lines · Balbir Singh
Quoted 7 lines · David Hildenbrand (Red Hat)
Quoted 6 lines · Balbir Singh

ret of type vm_fault_t is reused to capture the return value of nouveau_dmem_copy_folio(), which returns an int. Use a new copy_ret to fix the issue. The issue is not new, prior to this the function called was called nouveau_dmem_copy_one() and ret was used to capture it's value.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

It's a sparse warning, is there any runtime effect?

No impact really, it's just a sparse warning

Okay, then please

Quoted 8 lines

1) Make that clear in the patch description

2) Make that clear in the patch subject.

In particular, the current subject is weird. Should probably be

"nouveau/dmem: fix sparse warning in nouveau_dmem_migrate_to_ram()"

I did have "sparse warning" in the subject and checkpatch complained that tools should not be mentioned in the subject, but I'll give it a shot with that.

Quoted 2 lines

Change itself LGTM, although I would probably call it "int err" or something like that instead.

Ack, will do that and resend

Balbir

#5 lore raw
Quoted 24 lines · Balbir Singh
Quoted 23 lines · David Hildenbrand (Red Hat)
Quoted 8 lines · Balbir Singh
Quoted 7 lines · David Hildenbrand (Red Hat)
Quoted 6 lines · Balbir Singh

ret of type vm_fault_t is reused to capture the return value of nouveau_dmem_copy_folio(), which returns an int. Use a new copy_ret to fix the issue. The issue is not new, prior to this the function called was called nouveau_dmem_copy_one() and ret was used to capture it's value.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

It's a sparse warning, is there any runtime effect?

No impact really, it's just a sparse warning

Okay, then please

1) Make that clear in the patch description

2) Make that clear in the patch subject.

Quoted 7 lines
Quoted 4 lines

In particular, the current subject is weird. Should probably be

"nouveau/dmem: fix sparse warning in nouveau_dmem_migrate_to_ram()"

I did have "sparse warning" in the subject and checkpatch complained that tools should not be mentioned in the subject, but I'll give it a shot with that.

The important part is to be careful with the term "fix" when all we're fixing is some output of a static code analysis tool that does otherwise not result in any actual issues (build time, runtime).

Signature · 3 lines
Cheers

David