From f01c4e682c941ba70e0ebec44db754844a1b9b82 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Mon, 9 Nov 2015 09:21:27 +1000 Subject: [PATCH] drm/nouveau/nvif: modify nvif_unvers/nvif_unpack macros to be more obvious Signed-off-by: Ben Skeggs --- drivers/gpu/drm/nouveau/include/nvif/unpack.h | 34 ++++++----- drivers/gpu/drm/nouveau/nouveau_abi16.c | 4 +- drivers/gpu/drm/nouveau/nouveau_usif.c | 25 +++++---- drivers/gpu/drm/nouveau/nvkm/core/client.c | 8 +-- drivers/gpu/drm/nouveau/nvkm/core/ioctl.c | 56 +++++++++---------- .../gpu/drm/nouveau/nvkm/engine/device/ctrl.c | 12 ++-- .../gpu/drm/nouveau/nvkm/engine/device/user.c | 16 ++++-- .../gpu/drm/nouveau/nvkm/engine/disp/base.c | 8 +-- .../drm/nouveau/nvkm/engine/disp/basenv50.c | 4 +- .../drm/nouveau/nvkm/engine/disp/channv50.c | 4 +- .../drm/nouveau/nvkm/engine/disp/corenv50.c | 4 +- .../drm/nouveau/nvkm/engine/disp/cursnv50.c | 4 +- .../drm/nouveau/nvkm/engine/disp/dacnv50.c | 8 +-- .../drm/nouveau/nvkm/engine/disp/hdagf119.c | 4 +- .../drm/nouveau/nvkm/engine/disp/hdagt215.c | 4 +- .../drm/nouveau/nvkm/engine/disp/hdmig84.c | 4 +- .../drm/nouveau/nvkm/engine/disp/hdmigf119.c | 4 +- .../drm/nouveau/nvkm/engine/disp/hdmigk104.c | 4 +- .../drm/nouveau/nvkm/engine/disp/hdmigt215.c | 4 +- .../drm/nouveau/nvkm/engine/disp/oimmnv50.c | 4 +- .../drm/nouveau/nvkm/engine/disp/ovlynv50.c | 4 +- .../drm/nouveau/nvkm/engine/disp/piornv50.c | 4 +- .../drm/nouveau/nvkm/engine/disp/rootgf119.c | 4 +- .../drm/nouveau/nvkm/engine/disp/rootnv04.c | 8 +-- .../drm/nouveau/nvkm/engine/disp/rootnv50.c | 16 +++--- .../drm/nouveau/nvkm/engine/disp/sornv50.c | 4 +- .../gpu/drm/nouveau/nvkm/engine/dma/user.c | 4 +- .../drm/nouveau/nvkm/engine/dma/usergf100.c | 3 +- .../drm/nouveau/nvkm/engine/dma/usergf119.c | 3 +- .../drm/nouveau/nvkm/engine/dma/usernv50.c | 3 +- .../gpu/drm/nouveau/nvkm/engine/fifo/base.c | 4 +- .../gpu/drm/nouveau/nvkm/engine/fifo/dmag84.c | 4 +- .../drm/nouveau/nvkm/engine/fifo/dmanv04.c | 4 +- .../drm/nouveau/nvkm/engine/fifo/dmanv10.c | 4 +- .../drm/nouveau/nvkm/engine/fifo/dmanv17.c | 4 +- .../drm/nouveau/nvkm/engine/fifo/dmanv40.c | 4 +- .../drm/nouveau/nvkm/engine/fifo/dmanv50.c | 4 +- .../drm/nouveau/nvkm/engine/fifo/gpfifog84.c | 4 +- .../nouveau/nvkm/engine/fifo/gpfifogf100.c | 4 +- .../nouveau/nvkm/engine/fifo/gpfifogk104.c | 4 +- .../drm/nouveau/nvkm/engine/fifo/gpfifonv50.c | 4 +- .../gpu/drm/nouveau/nvkm/engine/gr/gf100.c | 9 +-- drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c | 28 +++++----- drivers/gpu/drm/nouveau/nvkm/engine/sw/chan.c | 4 +- drivers/gpu/drm/nouveau/nvkm/engine/sw/nv04.c | 4 +- 45 files changed, 186 insertions(+), 171 deletions(-) diff --git a/drivers/gpu/drm/nouveau/include/nvif/unpack.h b/drivers/gpu/drm/nouveau/include/nvif/unpack.h index 5933188b4a77..751bcf4930a7 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/unpack.h +++ b/drivers/gpu/drm/nouveau/include/nvif/unpack.h @@ -1,24 +1,28 @@ #ifndef __NVIF_UNPACK_H__ #define __NVIF_UNPACK_H__ -#define nvif_unvers(d) ({ \ - ret = (size == sizeof(d)) ? 0 : -ENOSYS; \ - (ret == 0); \ +#define nvif_unvers(r,d,s,m) ({ \ + void **_data = (d); __u32 *_size = (s); int _ret = (r); \ + if (_ret == -ENOSYS && *_size == sizeof(m)) { \ + *_data = NULL; \ + *_size = _ret = 0; \ + } \ + _ret; \ }) -#define nvif_unpack(d,vl,vh,m) ({ \ - if ((vl) == 0 || ret == -ENOSYS) { \ - int _size = sizeof(d); \ - if (_size <= size && (d).version >= (vl) && \ - (d).version <= (vh)) { \ - data = (u8 *)data + _size; \ - size = size - _size; \ - ret = ((m) || !size) ? 0 : -E2BIG; \ - } else { \ - ret = -ENOSYS; \ +#define nvif_unpack(r,d,s,m,vl,vh,x) ({ \ + void **_data = (d); __u32 *_size = (s); \ + int _ret = (r), _vl = (vl), _vh = (vh); \ + if (_ret == -ENOSYS && *_size >= sizeof(m) && \ + (m).version >= _vl && (m).version <= _vh) { \ + *_data = (__u8 *)*_data + sizeof(m); \ + *_size = *_size - sizeof(m); \ + if (_ret = 0, !(x)) { \ + _ret = *_size ? -E2BIG : 0; \ + *_data = NULL; \ + *_size = 0; \ } \ } \ - (ret == 0); \ + _ret; \ }) - #endif diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c index 054ef97df411..50f52ffe5b0c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_abi16.c +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c @@ -357,9 +357,9 @@ nouveau_abi16_usif(struct drm_file *file_priv, void *data, u32 size) } *args = data; struct nouveau_abi16_chan *chan; struct nouveau_abi16 *abi16; - int ret; + int ret = -ENOSYS; - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { switch (args->v0.type) { case NVIF_IOCTL_V0_NEW: case NVIF_IOCTL_V0_MTHD: diff --git a/drivers/gpu/drm/nouveau/nouveau_usif.c b/drivers/gpu/drm/nouveau/nouveau_usif.c index 6ae1b3494bcd..e9f52ef0be83 100644 --- a/drivers/gpu/drm/nouveau/nouveau_usif.c +++ b/drivers/gpu/drm/nouveau/nouveau_usif.c @@ -130,20 +130,21 @@ usif_notify_new(struct drm_file *f, void *data, u32 size, void *argv, u32 argc) struct nvif_notify_req_v0 v0; } *req; struct usif_notify *ntfy; - int ret; + int ret = -ENOSYS; - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { if (usif_notify_find(f, args->v0.index)) return -EEXIST; } else return ret; req = data; + ret = -ENOSYS; if (!(ntfy = kmalloc(sizeof(*ntfy), GFP_KERNEL))) return -ENOMEM; atomic_set(&ntfy->enabled, 0); - if (nvif_unpack(req->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, req->v0, 0, 0, true))) { ntfy->reply = sizeof(struct nvif_notify_rep_v0) + req->v0.reply; ntfy->route = req->v0.route; ntfy->token = req->v0.token; @@ -171,9 +172,9 @@ usif_notify_del(struct drm_file *f, void *data, u32 size, void *argv, u32 argc) struct nvif_ioctl_ntfy_del_v0 v0; } *args = data; struct usif_notify *ntfy; - int ret; + int ret = -ENOSYS; - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { if (!(ntfy = usif_notify_find(f, args->v0.index))) return -ENOENT; } else @@ -194,9 +195,9 @@ usif_notify_get(struct drm_file *f, void *data, u32 size, void *argv, u32 argc) struct nvif_ioctl_ntfy_del_v0 v0; } *args = data; struct usif_notify *ntfy; - int ret; + int ret = -ENOSYS; - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { if (!(ntfy = usif_notify_find(f, args->v0.index))) return -ENOENT; } else @@ -233,9 +234,9 @@ usif_notify_put(struct drm_file *f, void *data, u32 size, void *argv, u32 argc) struct nvif_ioctl_ntfy_put_v0 v0; } *args = data; struct usif_notify *ntfy; - int ret; + int ret = -ENOSYS; - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { if (!(ntfy = usif_notify_find(f, args->v0.index))) return -ENOENT; } else @@ -270,13 +271,13 @@ usif_object_new(struct drm_file *f, void *data, u32 size, void *argv, u32 argc) struct nvif_ioctl_new_v0 v0; } *args = data; struct usif_object *object; - int ret; + int ret = -ENOSYS; if (!(object = kmalloc(sizeof(*object), GFP_KERNEL))) return -ENOMEM; list_add(&object->head, &cli->objects); - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { object->route = args->v0.route; object->token = args->v0.token; args->v0.route = NVDRM_OBJECT_USIF; @@ -310,7 +311,7 @@ usif_ioctl(struct drm_file *filp, void __user *user, u32 argc) if (ret = -EFAULT, copy_from_user(argv, user, size)) goto done; - if (nvif_unpack(argv->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(-ENOSYS, &data, &size, argv->v0, 0, 0, true))) { /* block access to objects not created via this interface */ owner = argv->v0.owner; if (argv->v0.object == 0ULL) diff --git a/drivers/gpu/drm/nouveau/nvkm/core/client.c b/drivers/gpu/drm/nouveau/nvkm/core/client.c index 98e694179ace..e1943910858e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/client.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/client.c @@ -97,7 +97,7 @@ nvkm_client_notify_new(struct nvkm_object *object, struct nvif_notify_req_v0 v0; } *req = data; u8 index, reply; - int ret; + int ret = -ENOSYS; for (index = 0; index < ARRAY_SIZE(client->notify); index++) { if (!client->notify[index]) @@ -112,7 +112,7 @@ nvkm_client_notify_new(struct nvkm_object *object, return -ENOMEM; nvif_ioctl(object, "notify new size %d\n", size); - if (nvif_unpack(req->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, req->v0, 0, 0, true))) { nvif_ioctl(object, "notify new vers %d reply %d route %02x " "token %llx\n", req->v0.version, req->v0.reply, req->v0.route, req->v0.token); @@ -144,10 +144,10 @@ nvkm_client_mthd_devlist(struct nvkm_object *object, void *data, u32 size) union { struct nv_client_devlist_v0 v0; } *args = data; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "client devlist size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { nvif_ioctl(object, "client devlist vers %d count %d\n", args->v0.version, args->v0.count); if (size == sizeof(args->v0.device[0]) * args->v0.count) { diff --git a/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c b/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c index d87d6ab03cc7..b0db51847c36 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c @@ -34,10 +34,10 @@ nvkm_ioctl_nop(struct nvkm_object *object, void *data, u32 size) union { struct nvif_ioctl_nop_v0 v0; } *args = data; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "nop size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "nop vers %lld\n", args->v0.version); args->v0.version = NVIF_VERSION_LATEST; } @@ -52,10 +52,10 @@ nvkm_ioctl_sclass(struct nvkm_object *object, void *data, u32 size) struct nvif_ioctl_sclass_v0 v0; } *args = data; struct nvkm_oclass oclass; - int ret, i = 0; + int ret = -ENOSYS, i = 0; nvif_ioctl(object, "sclass size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { nvif_ioctl(object, "sclass vers %d count %d\n", args->v0.version, args->v0.count); if (size != args->v0.count * sizeof(args->v0.oclass[0])) @@ -86,10 +86,10 @@ nvkm_ioctl_new(struct nvkm_object *parent, void *data, u32 size) struct nvkm_client *client = parent->client; struct nvkm_object *object = NULL; struct nvkm_oclass oclass; - int ret, i = 0; + int ret = -ENOSYS, i = 0; nvif_ioctl(parent, "new size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { nvif_ioctl(parent, "new vers %d handle %08x class %08x " "route %02x token %llx object %016llx\n", args->v0.version, args->v0.handle, args->v0.oclass, @@ -147,10 +147,10 @@ nvkm_ioctl_del(struct nvkm_object *object, void *data, u32 size) union { struct nvif_ioctl_del none; } *args = data; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "delete size %d\n", size); - if (nvif_unvers(args->none)) { + if (!(ret = nvif_unvers(ret, &data, &size, args->none))) { nvif_ioctl(object, "delete\n"); nvkm_object_fini(object, false); nvkm_object_del(&object); @@ -165,10 +165,10 @@ nvkm_ioctl_mthd(struct nvkm_object *object, void *data, u32 size) union { struct nvif_ioctl_mthd_v0 v0; } *args = data; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "mthd size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { nvif_ioctl(object, "mthd vers %d mthd %02x\n", args->v0.version, args->v0.method); ret = nvkm_object_mthd(object, args->v0.method, data, size); @@ -189,10 +189,10 @@ nvkm_ioctl_rd(struct nvkm_object *object, void *data, u32 size) u16 b16; u32 b32; } v; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "rd size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "rd vers %d size %d addr %016llx\n", args->v0.version, args->v0.size, args->v0.addr); switch (args->v0.size) { @@ -223,10 +223,10 @@ nvkm_ioctl_wr(struct nvkm_object *object, void *data, u32 size) union { struct nvif_ioctl_wr_v0 v0; } *args = data; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "wr size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "wr vers %d size %d addr %016llx data %08x\n", args->v0.version, args->v0.size, args->v0.addr, @@ -251,10 +251,10 @@ nvkm_ioctl_map(struct nvkm_object *object, void *data, u32 size) union { struct nvif_ioctl_map_v0 v0; } *args = data; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "map size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "map vers %d\n", args->v0.version); ret = nvkm_object_map(object, &args->v0.handle, &args->v0.length); @@ -269,10 +269,10 @@ nvkm_ioctl_unmap(struct nvkm_object *object, void *data, u32 size) union { struct nvif_ioctl_unmap none; } *args = data; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "unmap size %d\n", size); - if (nvif_unvers(args->none)) { + if (!(ret = nvif_unvers(ret, &data, &size, args->none))) { nvif_ioctl(object, "unmap\n"); } @@ -286,10 +286,10 @@ nvkm_ioctl_ntfy_new(struct nvkm_object *object, void *data, u32 size) struct nvif_ioctl_ntfy_new_v0 v0; } *args = data; struct nvkm_event *event; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "ntfy new size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { nvif_ioctl(object, "ntfy new vers %d event %02x\n", args->v0.version, args->v0.event); ret = nvkm_object_ntfy(object, args->v0.event, &event); @@ -312,10 +312,10 @@ nvkm_ioctl_ntfy_del(struct nvkm_object *object, void *data, u32 size) union { struct nvif_ioctl_ntfy_del_v0 v0; } *args = data; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "ntfy del size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "ntfy del vers %d index %d\n", args->v0.version, args->v0.index); ret = nvkm_client_notify_del(client, args->v0.index); @@ -331,10 +331,10 @@ nvkm_ioctl_ntfy_get(struct nvkm_object *object, void *data, u32 size) union { struct nvif_ioctl_ntfy_get_v0 v0; } *args = data; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "ntfy get size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "ntfy get vers %d index %d\n", args->v0.version, args->v0.index); ret = nvkm_client_notify_get(client, args->v0.index); @@ -350,10 +350,10 @@ nvkm_ioctl_ntfy_put(struct nvkm_object *object, void *data, u32 size) union { struct nvif_ioctl_ntfy_put_v0 v0; } *args = data; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "ntfy put size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "ntfy put vers %d index %d\n", args->v0.version, args->v0.index); ret = nvkm_client_notify_put(client, args->v0.index); @@ -421,12 +421,12 @@ nvkm_ioctl(struct nvkm_client *client, bool supervisor, union { struct nvif_ioctl_v0 v0; } *args = data; - int ret; + int ret = -ENOSYS; client->super = supervisor; nvif_ioctl(object, "size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { nvif_ioctl(object, "vers %d type %02x object %016llx owner %02x\n", args->v0.version, args->v0.type, args->v0.object, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c index 5e84b2f9f32a..b0ece71aefde 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c @@ -38,10 +38,10 @@ nvkm_control_mthd_pstate_info(struct nvkm_control *ctrl, void *data, u32 size) struct nvif_control_pstate_info_v0 v0; } *args = data; struct nvkm_clk *clk = ctrl->device->clk; - int ret; + int ret = -ENOSYS; nvif_ioctl(&ctrl->object, "control pstate info size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(&ctrl->object, "control pstate info vers %d\n", args->v0.version); } else @@ -76,10 +76,10 @@ nvkm_control_mthd_pstate_attr(struct nvkm_control *ctrl, void *data, u32 size) struct nvkm_cstate *cstate; int i = 0, j = -1; u32 lo, hi; - int ret; + int ret = -ENOSYS; nvif_ioctl(&ctrl->object, "control pstate attr size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(&ctrl->object, "control pstate attr vers %d state %d index %d\n", args->v0.version, args->v0.state, args->v0.index); @@ -144,10 +144,10 @@ nvkm_control_mthd_pstate_user(struct nvkm_control *ctrl, void *data, u32 size) struct nvif_control_pstate_user_v0 v0; } *args = data; struct nvkm_clk *clk = ctrl->device->clk; - int ret; + int ret = -ENOSYS; nvif_ioctl(&ctrl->object, "control pstate user size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(&ctrl->object, "control pstate user vers %d ustate %d pwrsrc %d\n", args->v0.version, args->v0.ustate, args->v0.pwrsrc); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c index 22a2d7632d49..137066426ed7 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c @@ -49,10 +49,10 @@ nvkm_udevice_info(struct nvkm_udevice *udev, void *data, u32 size) union { struct nv_device_info_v0 v0; } *args = data; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "device info size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "device info vers %d\n", args->v0.version); } else return ret; @@ -124,13 +124,16 @@ nvkm_udevice_info(struct nvkm_udevice *udev, void *data, u32 size) static int nvkm_udevice_time(struct nvkm_udevice *udev, void *data, u32 size) { + struct nvkm_object *object = &udev->object; struct nvkm_device *device = udev->device; union { struct nv_device_time_v0 v0; } *args = data; - int ret; + int ret = -ENOSYS; - if (nvif_unpack(args->v0, 0, 0, false)) { + nvif_ioctl(object, "device time size %d\n", size); + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { + nvif_ioctl(object, "device time vers %d\n", args->v0.version); args->v0.time = nvkm_timer_read(device->timer); } @@ -141,6 +144,7 @@ static int nvkm_udevice_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size) { struct nvkm_udevice *udev = nvkm_udevice(object); + nvif_ioctl(object, "device mthd %08x\n", mthd); switch (mthd) { case NV_DEVICE_V0_INFO: return nvkm_udevice_info(udev, data, size); @@ -332,10 +336,10 @@ nvkm_udevice_new(const struct nvkm_oclass *oclass, void *data, u32 size, struct nvkm_object *parent = &client->object; const struct nvkm_object_func *func; struct nvkm_udevice *udev; - int ret; + int ret = -ENOSYS; nvif_ioctl(parent, "create device size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create device v%d device %016llx\n", args->v0.version, args->v0.device); } else diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c index 9ac1638ae0ce..785fa76d0fbf 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c @@ -59,9 +59,9 @@ nvkm_disp_vblank_ctor(struct nvkm_object *object, void *data, u32 size, union { struct nvif_notify_head_req_v0 v0; } *req = data; - int ret; + int ret = -ENOSYS; - if (nvif_unpack(req->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, req->v0, 0, 0, false))) { notify->size = sizeof(struct nvif_notify_head_rep_v0); if (ret = -ENXIO, req->v0.head <= disp->vblank.index_nr) { notify->types = 1; @@ -97,9 +97,9 @@ nvkm_disp_hpd_ctor(struct nvkm_object *object, void *data, u32 size, struct nvif_notify_conn_req_v0 v0; } *req = data; struct nvkm_output *outp; - int ret; + int ret = -ENOSYS; - if (nvif_unpack(req->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, req->v0, 0, 0, false))) { notify->size = sizeof(struct nvif_notify_conn_rep_v0); list_for_each_entry(outp, &disp->outp, head) { if (ret = -ENXIO, outp->conn->index == req->v0.conn) { diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/basenv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/basenv50.c index 23e3d43e50a0..83f152300ec0 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/basenv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/basenv50.c @@ -42,11 +42,11 @@ nv50_disp_base_new(const struct nv50_disp_dmac_func *func, } *args = data; struct nvkm_object *parent = oclass->parent; struct nv50_disp *disp = root->disp; - int head, ret; + int head, ret = -ENOSYS; u64 push; nvif_ioctl(parent, "create disp base channel dma size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create disp base channel dma vers %d " "pushbuf %016llx head %d\n", args->v0.version, args->v0.pushbuf, args->v0.head); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c index 41d0ad2646a4..dd2953bc9264 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c @@ -134,9 +134,9 @@ nv50_disp_chan_uevent_ctor(struct nvkm_object *object, void *data, u32 size, union { struct nvif_notify_uevent_req none; } *args = data; - int ret; + int ret = -ENOSYS; - if (nvif_unvers(args->none)) { + if (!(ret = nvif_unvers(ret, &data, &size, args->none))) { notify->size = sizeof(struct nvif_notify_uevent_rep); notify->types = 1; notify->index = chan->chid; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/corenv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/corenv50.c index 6901b712da3f..b547c8b833ca 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/corenv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/corenv50.c @@ -43,10 +43,10 @@ nv50_disp_core_new(const struct nv50_disp_dmac_func *func, } *args = data; struct nvkm_object *parent = oclass->parent; u64 push; - int ret; + int ret = -ENOSYS; nvif_ioctl(parent, "create disp core channel dma size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create disp core channel dma vers %d " "pushbuf %016llx\n", args->v0.version, args->v0.pushbuf); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/cursnv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/cursnv50.c index 3e9d27ea41a2..8b1320499a0f 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/cursnv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/cursnv50.c @@ -42,10 +42,10 @@ nv50_disp_curs_new(const struct nv50_disp_chan_func *func, } *args = data; struct nvkm_object *parent = oclass->parent; struct nv50_disp *disp = root->disp; - int head, ret; + int head, ret = -ENOSYS; nvif_ioctl(parent, "create disp cursor size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create disp cursor vers %d head %d\n", args->v0.version, args->v0.head); if (args->v0.head > disp->base.head.nr) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/dacnv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/dacnv50.c index 4a3e0f113ea0..c9b78b8f9c87 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/dacnv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/dacnv50.c @@ -39,10 +39,10 @@ nv50_dac_power(NV50_DISP_MTHD_V1) struct nv50_disp_dac_pwr_v0 v0; } *args = data; u32 stat; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "disp dac pwr size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "disp dac pwr vers %d state %d data %d " "vsync %d hsync %d\n", args->v0.version, args->v0.state, args->v0.data, @@ -76,10 +76,10 @@ nv50_dac_sense(NV50_DISP_MTHD_V1) } *args = data; const u32 doff = outp->or * 0x800; u32 loadval; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "disp dac load size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "disp dac load vers %d data %08x\n", args->v0.version, args->v0.data); if (args->v0.data & 0xfff00000) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c index ae7343dda04e..da6129b2b78f 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagf119.c @@ -41,10 +41,10 @@ gf119_hda_eld(NV50_DISP_MTHD_V1) } *args = data; const u32 soff = outp->or * 0x030; const u32 hoff = head * 0x800; - int ret, i; + int ret = -ENOSYS, i; nvif_ioctl(object, "disp sor hda eld size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { nvif_ioctl(object, "disp sor hda eld vers %d\n", args->v0.version); if (size > 0x60) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c index e6390e974061..6f0436df0219 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c @@ -38,10 +38,10 @@ gt215_hda_eld(NV50_DISP_MTHD_V1) struct nv50_disp_sor_hda_eld_v0 v0; } *args = data; const u32 soff = outp->or * 0x800; - int ret, i; + int ret = -ENOSYS, i; nvif_ioctl(object, "disp sor hda eld size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { nvif_ioctl(object, "disp sor hda eld vers %d\n", args->v0.version); if (size > 0x60) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c index 3eca62a29909..1c4256e8cbd6 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c @@ -37,10 +37,10 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1) struct nv50_disp_sor_hdmi_pwr_v0 v0; } *args = data; u32 ctrl; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d " "max_ac_packet %d rekey %d\n", args->v0.version, args->v0.state, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c index 62ca1feaff66..632f02da1382 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c @@ -37,10 +37,10 @@ gf119_hdmi_ctrl(NV50_DISP_MTHD_V1) struct nv50_disp_sor_hdmi_pwr_v0 v0; } *args = data; u32 ctrl; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d " "max_ac_packet %d rekey %d\n", args->v0.version, args->v0.state, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c index efba0e12ff1c..4e8067d511d7 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c @@ -38,10 +38,10 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1) struct nv50_disp_sor_hdmi_pwr_v0 v0; } *args = data; u32 ctrl; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d " "max_ac_packet %d rekey %d\n", args->v0.version, args->v0.state, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c index 472444c837bf..f1afc16494b6 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c @@ -38,10 +38,10 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1) struct nv50_disp_sor_hdmi_pwr_v0 v0; } *args = data; u32 ctrl; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d " "max_ac_packet %d rekey %d\n", args->v0.version, args->v0.state, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/oimmnv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/oimmnv50.c index 8e9a06487d14..3940b9c966ec 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/oimmnv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/oimmnv50.c @@ -42,10 +42,10 @@ nv50_disp_oimm_new(const struct nv50_disp_chan_func *func, } *args = data; struct nvkm_object *parent = oclass->parent; struct nv50_disp *disp = root->disp; - int head, ret; + int head, ret = -ENOSYS; nvif_ioctl(parent, "create disp overlay size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create disp overlay vers %d head %d\n", args->v0.version, args->v0.head); if (args->v0.head > disp->base.head.nr) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ovlynv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ovlynv50.c index 503e9b5761c1..2a49c46425cd 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ovlynv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ovlynv50.c @@ -42,11 +42,11 @@ nv50_disp_ovly_new(const struct nv50_disp_dmac_func *func, } *args = data; struct nvkm_object *parent = oclass->parent; struct nv50_disp *disp = root->disp; - int head, ret; + int head, ret = -ENOSYS; u64 push; nvif_ioctl(parent, "create disp overlay channel dma size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create disp overlay channel dma vers %d " "pushbuf %016llx head %d\n", args->v0.version, args->v0.pushbuf, args->v0.head); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/piornv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/piornv50.c index dcd1836800bf..6c532eadba17 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/piornv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/piornv50.c @@ -40,10 +40,10 @@ nv50_pior_power(NV50_DISP_MTHD_V1) struct nv50_disp_pior_pwr_v0 v0; } *args = data; u32 ctrl, type; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "disp pior pwr size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "disp pior pwr vers %d state %d type %x\n", args->v0.version, args->v0.state, args->v0.type); if (args->v0.type > 0x0f) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgf119.c index 09d12067b1bb..335d88823c22 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgf119.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgf119.c @@ -42,10 +42,10 @@ gf119_disp_root_scanoutpos(NV50_DISP_MTHD_V0) union { struct nv50_disp_scanoutpos_v0 v0; } *args = data; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "disp scanoutpos size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "disp scanoutpos vers %d\n", args->v0.version); args->v0.vblanke = (blanke & 0xffff0000) >> 16; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv04.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv04.c index d73f1c6e3254..f535f43231e2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv04.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv04.c @@ -46,10 +46,10 @@ nv04_disp_scanoutpos(struct nv04_disp_root *root, struct nv04_disp_scanoutpos_v0 v0; } *args = data; u32 line; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "disp scanoutpos size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "disp scanoutpos vers %d\n", args->v0.version); args->v0.vblanks = nvkm_rd32(device, 0x680800 + hoff) & 0xffff; @@ -86,10 +86,10 @@ nv04_disp_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size) union { struct nv04_disp_mthd_v0 v0; } *args = data; - int head, ret; + int head, ret = -ENOSYS; nvif_ioctl(object, "disp mthd size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { nvif_ioctl(object, "disp mthd vers %d mthd %02x head %d\n", args->v0.version, args->v0.method, args->v0.head); mthd = args->v0.method; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c index 2aba84d51b1e..2f9cecd81d04 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c @@ -42,10 +42,10 @@ nv50_disp_root_scanoutpos(NV50_DISP_MTHD_V0) union { struct nv50_disp_scanoutpos_v0 v0; } *args = data; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "disp scanoutpos size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "disp scanoutpos vers %d\n", args->v0.version); args->v0.vblanke = (blanke & 0xffff0000) >> 16; @@ -79,19 +79,19 @@ nv50_disp_root_mthd_(struct nvkm_object *object, u32 mthd, void *data, u32 size) struct nvkm_output *outp = NULL; struct nvkm_output *temp; u16 type, mask = 0; - int head, ret; + int head, ret = -ENOSYS; if (mthd != NV50_DISP_MTHD) return -EINVAL; nvif_ioctl(object, "disp mthd size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { nvif_ioctl(object, "disp mthd vers %d mthd %02x head %d\n", args->v0.version, args->v0.method, args->v0.head); mthd = args->v0.method; head = args->v0.head; } else - if (nvif_unpack(args->v1, 1, 1, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v1, 1, 1, true))) { nvif_ioctl(object, "disp mthd vers %d mthd %02x " "type %04x mask %04x\n", args->v1.version, args->v1.method, @@ -144,8 +144,9 @@ nv50_disp_root_mthd_(struct nvkm_object *object, u32 mthd, void *data, u32 size) union { struct nv50_disp_sor_lvds_script_v0 v0; } *args = data; + int ret = -ENOSYS; nvif_ioctl(object, "disp sor lvds script size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "disp sor lvds script " "vers %d name %04x\n", args->v0.version, args->v0.script); @@ -160,8 +161,9 @@ nv50_disp_root_mthd_(struct nvkm_object *object, u32 mthd, void *data, u32 size) union { struct nv50_disp_sor_dp_pwr_v0 v0; } *args = data; + int ret = -ENOSYS; nvif_ioctl(object, "disp sor dp pwr size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "disp sor dp pwr vers %d state %d\n", args->v0.version, args->v0.state); if (args->v0.state == 0) { diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sornv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sornv50.c index 6e8c954518d8..53596bed3c36 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sornv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sornv50.c @@ -39,10 +39,10 @@ nv50_sor_power(NV50_DISP_MTHD_V1) } *args = data; const u32 soff = outp->or * 0x800; u32 stat; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "disp sor pwr size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "disp sor pwr vers %d state %d\n", args->v0.version, args->v0.state); stat = !!args->v0.state; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/dma/user.c b/drivers/gpu/drm/nouveau/nvkm/engine/dma/user.c index 4a4e3b13d6b1..13c661b1ef14 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/dma/user.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/dma/user.c @@ -69,7 +69,7 @@ nvkm_dmaobj_ctor(const struct nvkm_dmaobj_func *func, struct nvkm_dma *dma, struct nvkm_fb *fb = device->fb; void *data = *pdata; u32 size = *psize; - int ret; + int ret = -ENOSYS; nvkm_object_ctor(&nvkm_dmaobj_func, oclass, &dmaobj->object); dmaobj->func = func; @@ -77,7 +77,7 @@ nvkm_dmaobj_ctor(const struct nvkm_dmaobj_func *func, struct nvkm_dma *dma, RB_CLEAR_NODE(&dmaobj->rb); nvif_ioctl(parent, "create dma size %d\n", *psize); - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { nvif_ioctl(parent, "create dma vers %d target %d access %d " "start %016llx limit %016llx\n", args->v0.version, args->v0.target, args->v0.access, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/dma/usergf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/dma/usergf100.c index 93435a4a6df9..ef7ac360101e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/dma/usergf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/dma/usergf100.c @@ -87,10 +87,11 @@ gf100_dmaobj_new(struct nvkm_dma *dma, const struct nvkm_oclass *oclass, if (ret) return ret; + ret = -ENOSYS; args = data; nvif_ioctl(parent, "create gf100 dma size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create gf100 dma vers %d priv %d kind %02x\n", args->v0.version, args->v0.priv, args->v0.kind); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/dma/usergf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/dma/usergf119.c index fc7c97eaf970..c068cee34588 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/dma/usergf119.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/dma/usergf119.c @@ -85,10 +85,11 @@ gf119_dmaobj_new(struct nvkm_dma *dma, const struct nvkm_oclass *oclass, if (ret) return ret; + ret = -ENOSYS; args = data; nvif_ioctl(parent, "create gf119 dma size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create gf100 dma vers %d page %d kind %02x\n", args->v0.version, args->v0.page, args->v0.kind); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/dma/usernv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/dma/usernv50.c index f3ec8df1dd8c..6a85b5dea643 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/dma/usernv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/dma/usernv50.c @@ -87,10 +87,11 @@ nv50_dmaobj_new(struct nvkm_dma *dma, const struct nvkm_oclass *oclass, if (ret) return ret; + ret = -ENOSYS; args = data; nvif_ioctl(parent, "create nv50 dma size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create nv50 dma vers %d priv %d part %d " "comp %d kind %02x\n", args->v0.version, args->v0.priv, args->v0.part, args->v0.comp, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c index 1fbbfbe6ca9c..cfc7d5725a61 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c @@ -129,9 +129,9 @@ nvkm_fifo_uevent_ctor(struct nvkm_object *object, void *data, u32 size, union { struct nvif_notify_uevent_req none; } *req = data; - int ret; + int ret = -ENOSYS; - if (nvif_unvers(req->none)) { + if (!(ret = nvif_unvers(ret, &data, &size, req->none))) { notify->size = sizeof(struct nvif_notify_uevent_rep); notify->types = 1; notify->index = 0; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmag84.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmag84.c index 4091727d07ed..caa914074752 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmag84.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmag84.c @@ -40,10 +40,10 @@ g84_fifo_dma_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass, } *args = data; struct nv50_fifo *fifo = nv50_fifo(base); struct nv50_fifo_chan *chan; - int ret; + int ret = -ENOSYS; nvif_ioctl(parent, "create channel dma size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create channel dma vers %d vm %llx " "pushbuf %llx offset %016llx\n", args->v0.version, args->v0.vm, args->v0.pushbuf, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv04.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv04.c index 51af281a0b14..edec30fd3ecd 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv04.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv04.c @@ -168,10 +168,10 @@ nv04_fifo_dma_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass, struct nv04_fifo_chan *chan = NULL; struct nvkm_device *device = fifo->base.engine.subdev.device; struct nvkm_instmem *imem = device->imem; - int ret; + int ret = -ENOSYS; nvif_ioctl(parent, "create channel dma size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create channel dma vers %d pushbuf %llx " "offset %08x\n", args->v0.version, args->v0.pushbuf, args->v0.offset); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv10.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv10.c index e676af4504c2..f5f355ff005d 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv10.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv10.c @@ -44,10 +44,10 @@ nv10_fifo_dma_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass, struct nv04_fifo_chan *chan = NULL; struct nvkm_device *device = fifo->base.engine.subdev.device; struct nvkm_instmem *imem = device->imem; - int ret; + int ret = -ENOSYS; nvif_ioctl(parent, "create channel dma size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create channel dma vers %d pushbuf %llx " "offset %08x\n", args->v0.version, args->v0.pushbuf, args->v0.offset); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv17.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv17.c index ee364e287d0a..7edc6a564b5d 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv17.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv17.c @@ -44,10 +44,10 @@ nv17_fifo_dma_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass, struct nv04_fifo_chan *chan = NULL; struct nvkm_device *device = fifo->base.engine.subdev.device; struct nvkm_instmem *imem = device->imem; - int ret; + int ret = -ENOSYS; nvif_ioctl(parent, "create channel dma size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create channel dma vers %d pushbuf %llx " "offset %08x\n", args->v0.version, args->v0.pushbuf, args->v0.offset); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv40.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv40.c index c75a41eaaa24..0ec179fc40a1 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv40.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv40.c @@ -189,10 +189,10 @@ nv40_fifo_dma_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass, struct nv04_fifo_chan *chan = NULL; struct nvkm_device *device = fifo->base.engine.subdev.device; struct nvkm_instmem *imem = device->imem; - int ret; + int ret = -ENOSYS; nvif_ioctl(parent, "create channel dma size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create channel dma vers %d pushbuf %llx " "offset %08x\n", args->v0.version, args->v0.pushbuf, args->v0.offset); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv50.c index 982bed04c6a4..480bc3777be5 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv50.c @@ -40,10 +40,10 @@ nv50_fifo_dma_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass, } *args = data; struct nv50_fifo *fifo = nv50_fifo(base); struct nv50_fifo_chan *chan; - int ret; + int ret = -ENOSYS; nvif_ioctl(parent, "create channel dma size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create channel dma vers %d vm %llx " "pushbuf %llx offset %016llx\n", args->v0.version, args->v0.vm, args->v0.pushbuf, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifog84.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifog84.c index e463100f74da..77c2f2a28bf3 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifog84.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifog84.c @@ -41,10 +41,10 @@ g84_fifo_gpfifo_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass, struct nv50_fifo *fifo = nv50_fifo(base); struct nv50_fifo_chan *chan; u64 ioffset, ilength; - int ret; + int ret = -ENOSYS; nvif_ioctl(parent, "create channel gpfifo size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create channel gpfifo vers %d vm %llx " "pushbuf %llx ioffset %016llx " "ilength %08x\n", diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogf100.c index 8db9cf018c89..cbc67f262322 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogf100.c @@ -200,10 +200,10 @@ gf100_fifo_gpfifo_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass, struct nvkm_object *parent = oclass->parent; struct gf100_fifo_chan *chan; u64 usermem, ioffset, ilength; - int ret, i; + int ret = -ENOSYS, i; nvif_ioctl(parent, "create channel gpfifo size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create channel gpfifo vers %d vm %llx " "ioffset %016llx ilength %08x\n", args->v0.version, args->v0.vm, args->v0.ioffset, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogk104.c index ba2bfe59c041..2e1df01bd928 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogk104.c @@ -214,10 +214,10 @@ gk104_fifo_gpfifo_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass, struct gk104_fifo_chan *chan; u64 usermem, ioffset, ilength; u32 engines; - int ret, i; + int ret = -ENOSYS, i; nvif_ioctl(parent, "create channel gpfifo size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create channel gpfifo vers %d vm %llx " "ioffset %016llx ilength %08x engine %08x\n", args->v0.version, args->v0.vm, args->v0.ioffset, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifonv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifonv50.c index 94456cad3ef0..c5a7de9db259 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifonv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifonv50.c @@ -41,10 +41,10 @@ nv50_fifo_gpfifo_new(struct nvkm_fifo *base, const struct nvkm_oclass *oclass, struct nv50_fifo *fifo = nv50_fifo(base); struct nv50_fifo_chan *chan; u64 ioffset, ilength; - int ret; + int ret = -ENOSYS; nvif_ioctl(parent, "create channel gpfifo size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create channel gpfifo vers %d vm %llx " "pushbuf %llx ioffset %016llx " "ilength %08x\n", diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c index d423a0686a31..3c6effbf19d6 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c @@ -148,9 +148,9 @@ gf100_fermi_mthd_zbc_color(struct nvkm_object *object, void *data, u32 size) union { struct fermi_a_zbc_color_v0 v0; } *args = data; - int ret; + int ret = -ENOSYS; - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { switch (args->v0.format) { case FERMI_A_ZBC_COLOR_V0_FMT_ZERO: case FERMI_A_ZBC_COLOR_V0_FMT_UNORM_ONE: @@ -194,9 +194,9 @@ gf100_fermi_mthd_zbc_depth(struct nvkm_object *object, void *data, u32 size) union { struct fermi_a_zbc_depth_v0 v0; } *args = data; - int ret; + int ret = -ENOSYS; - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { switch (args->v0.format) { case FERMI_A_ZBC_DEPTH_V0_FMT_FP32: ret = gf100_gr_zbc_depth_get(gr, args->v0.format, @@ -214,6 +214,7 @@ gf100_fermi_mthd_zbc_depth(struct nvkm_object *object, void *data, u32 size) static int gf100_fermi_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size) { + nvif_ioctl(object, "fermi mthd %08x\n", mthd); switch (mthd) { case FERMI_A_ZBC_COLOR: return gf100_fermi_mthd_zbc_color(object, data, size); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c index 344b1e5d7f85..f19fabef8d73 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c @@ -212,10 +212,10 @@ nvkm_perfdom_init(struct nvkm_perfdom *dom, void *data, u32 size) } *args = data; struct nvkm_object *object = &dom->object; struct nvkm_pm *pm = dom->perfmon->pm; - int ret, i; + int ret = -ENOSYS, i; nvif_ioctl(object, "perfdom init size %d\n", size); - if (nvif_unvers(args->none)) { + if (!(ret = nvif_unvers(ret, &data, &size, args->none))) { nvif_ioctl(object, "perfdom init\n"); } else return ret; @@ -242,10 +242,10 @@ nvkm_perfdom_sample(struct nvkm_perfdom *dom, void *data, u32 size) } *args = data; struct nvkm_object *object = &dom->object; struct nvkm_pm *pm = dom->perfmon->pm; - int ret; + int ret = -ENOSYS; nvif_ioctl(object, "perfdom sample size %d\n", size); - if (nvif_unvers(args->none)) { + if (!(ret = nvif_unvers(ret, &data, &size, args->none))) { nvif_ioctl(object, "perfdom sample\n"); } else return ret; @@ -266,10 +266,10 @@ nvkm_perfdom_read(struct nvkm_perfdom *dom, void *data, u32 size) } *args = data; struct nvkm_object *object = &dom->object; struct nvkm_pm *pm = dom->perfmon->pm; - int ret, i; + int ret = -ENOSYS, i; nvif_ioctl(object, "perfdom read size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "perfdom read vers %d\n", args->v0.version); } else return ret; @@ -376,10 +376,10 @@ nvkm_perfdom_new_(struct nvkm_perfmon *perfmon, struct nvkm_perfctr *ctr[4] = {}; struct nvkm_perfdom *dom; int c, s, m; - int ret; + int ret = -ENOSYS; nvif_ioctl(parent, "create perfdom size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create perfdom vers %d dom %d mode %02x\n", args->v0.version, args->v0.domain, args->v0.mode); } else @@ -441,10 +441,10 @@ nvkm_perfmon_mthd_query_domain(struct nvkm_perfmon *perfmon, struct nvkm_pm *pm = perfmon->pm; struct nvkm_perfdom *dom; u8 domain_nr; - int di, ret; + int di, ret = -ENOSYS; nvif_ioctl(object, "perfmon query domain size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "perfmon domain vers %d iter %02x\n", args->v0.version, args->v0.iter); di = (args->v0.iter & 0xff) - 1; @@ -492,10 +492,10 @@ nvkm_perfmon_mthd_query_signal(struct nvkm_perfmon *perfmon, struct nvkm_perfsig *sig; const bool all = nvkm_boolopt(device->cfgopt, "NvPmShowAll", false); const bool raw = nvkm_boolopt(device->cfgopt, "NvPmUnnamed", all); - int ret, si; + int ret = -ENOSYS, si; nvif_ioctl(object, "perfmon query signal size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "perfmon query signal vers %d dom %d iter %04x\n", args->v0.version, args->v0.domain, args->v0.iter); @@ -545,10 +545,10 @@ nvkm_perfmon_mthd_query_source(struct nvkm_perfmon *perfmon, struct nvkm_perfsig *sig; struct nvkm_perfsrc *src; u8 source_nr = 0; - int si, ret; + int si, ret = -ENOSYS; nvif_ioctl(object, "perfmon query source size %d\n", size); - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { nvif_ioctl(object, "perfmon source vers %d dom %d sig %02x iter %02x\n", args->v0.version, args->v0.domain, args->v0.signal, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/sw/chan.c b/drivers/gpu/drm/nouveau/nvkm/engine/sw/chan.c index d082f4f73a80..f28967065639 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/sw/chan.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/sw/chan.c @@ -53,9 +53,9 @@ nvkm_sw_chan_event_ctor(struct nvkm_object *object, void *data, u32 size, union { struct nvif_notify_uevent_req none; } *req = data; - int ret; + int ret = -ENOSYS; - if (nvif_unvers(req->none)) { + if (!(ret = nvif_unvers(ret, &data, &size, req->none))) { notify->size = sizeof(struct nvif_notify_uevent_rep); notify->types = 1; notify->index = 0; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv04.c b/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv04.c index 648caac3841a..b6675fe1b0ce 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv04.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv04.c @@ -47,9 +47,9 @@ nv04_nvsw_mthd_get_ref(struct nvkm_nvsw *nvsw, void *data, u32 size) union { struct nv04_nvsw_get_ref_v0 v0; } *args = data; - int ret; + int ret = -ENOSYS; - if (nvif_unpack(args->v0, 0, 0, false)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { args->v0.ref = atomic_read(&chan->ref); } -- 2.20.1