Module Name:    src
Committed By:   riastradh
Date:           Sun Dec 19 11:06:04 UTC 2021

Modified Files:
        src/sys/external/bsd/drm2/dist/drm/nouveau/nvif: nouveau_nvif_object.c

Log Message:
nouveau: Initialize object->map.tag/addr/size before use.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
    src/sys/external/bsd/drm2/dist/drm/nouveau/nvif/nouveau_nvif_object.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nvif/nouveau_nvif_object.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nvif/nouveau_nvif_object.c:1.6 src/sys/external/bsd/drm2/dist/drm/nouveau/nvif/nouveau_nvif_object.c:1.7
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nvif/nouveau_nvif_object.c:1.6	Sun Dec 19 10:51:57 2021
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvif/nouveau_nvif_object.c	Sun Dec 19 11:06:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_nvif_object.c,v 1.6 2021/12/19 10:51:57 riastradh Exp $	*/
+/*	$NetBSD: nouveau_nvif_object.c,v 1.7 2021/12/19 11:06:03 riastradh Exp $	*/
 
 /*
  * Copyright 2014 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvif_object.c,v 1.6 2021/12/19 10:51:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvif_object.c,v 1.7 2021/12/19 11:06:03 riastradh Exp $");
 
 #include <nvif/object.h>
 #include <nvif/client.h>
@@ -259,13 +259,21 @@ nvif_object_map(struct nvif_object *obje
 	if (ret >= 0) {
 		if (ret) {
 #ifdef __NetBSD__
-			ret = client->driver->map(client, tag, handle,
-			    object->map.size,
+			/*
+			 * Note: handle is the bus address;
+			 * object->map.handle is the
+			 * bus_space_handle_t, which is typically a
+			 * virtual address mapped in kva.
+			 */
+			object->map.tag = tag;
+			object->map.addr = handle;
+			ret = client->driver->map(client, tag, handle, length,
 			    &object->map.handle, &object->map.ptr);
 			if (ret) {
 				nvif_object_unmap(object);
 				return -ENOMEM;
 			}
+			object->map.size = length;
 #else
 			object->map.ptr = client->driver->map(client,
 							      handle,

Reply via email to