diff --git a/drivers/gpu/drm/nouveau/include/nvif/object.h b/drivers/gpu/drm/nouveau/include/nvif/object.h index 1e4c158d20fabbd0abfbaab170d9a65ce6a52eef..f52399caee820c61cc421b0de9c5047eef491f2f 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/object.h +++ b/drivers/gpu/drm/nouveau/include/nvif/object.h @@ -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 *); diff --git a/drivers/gpu/drm/nouveau/nvif/object.c b/drivers/gpu/drm/nouveau/nvif/object.c index dce1ecee2af5a5cca1978264cc3cd5a5d11f3957..4d1aaee8fe15fcb1a8e2514095066809b8ebe1e7 100644 --- a/drivers/gpu/drm/nouveau/nvif/object.c +++ b/drivers/gpu/drm/nouveau/nvif/object.c @@ -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);