drm/nouveau/nvif: return success from sclass even for objects without children
authorBen Skeggs <bskeggs@redhat.com>
Thu, 20 Aug 2015 04:54:16 +0000 (14:54 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 28 Aug 2015 02:40:32 +0000 (12:40 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/core/ioctl.c

index 629ee56..ee6ff01 100644 (file)
@@ -57,18 +57,18 @@ nvkm_ioctl_sclass(struct nvkm_handle *handle, void *data, u32 size)
        } *args = data;
        int ret;
 
-       if (!nv_iclass(object, NV_PARENT_CLASS)) {
-               nvif_debug(object, "cannot have children (sclass)\n");
-               return -ENODEV;
-       }
-
        nvif_ioctl(object, "sclass size %d\n", size);
        if (nvif_unpack(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])) {
-                       ret = nvkm_parent_lclass(object, args->v0.oclass,
+                       if (nv_iclass(object, NV_PARENT_CLASS)) {
+                               ret = nvkm_parent_lclass(object,
+                                                        args->v0.oclass,
                                                         args->v0.count);
+                       } else {
+                               ret = 0;
+                       }
                        if (ret >= 0) {
                                args->v0.count = ret;
                                ret = 0;