OSDN Git Service

drm/nouveau/nvif: add wrapper for open-coded nvif_object_constructed()
authorBen Skeggs <bskeggs@redhat.com>
Wed, 1 Jun 2022 10:46:00 +0000 (20:46 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 13 Jul 2022 03:55:12 +0000 (13:55 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/nouveau/include/nvif/object.h
drivers/gpu/drm/nouveau/nvif/object.c

index 1e4c158..f52399c 100644 (file)
@@ -22,6 +22,12 @@ struct nvif_object {
        } map;
 };
 
+static inline bool
+nvif_object_constructed(struct nvif_object *object)
+{
+       return object->client != NULL;
+}
+
 int  nvif_object_ctor(struct nvif_object *, const char *name, u32 handle,
                      s32 oclass, void *, u32, struct nvif_object *);
 void nvif_object_dtor(struct nvif_object *);
index dce1ece..4d1aaee 100644 (file)
@@ -250,7 +250,7 @@ nvif_object_dtor(struct nvif_object *object)
                .ioctl.type = NVIF_IOCTL_V0_DEL,
        };
 
-       if (!object->client)
+       if (!nvif_object_constructed(object))
                return;
 
        nvif_object_unmap(object);