aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Bornecrantz2009-12-04 09:06:42 -0600
committerJakob Bornecrantz2009-12-04 09:11:56 -0600
commit201f5795a26ae7b5580a35b24f4e89e5cd3455b1 (patch)
treea4c8f225beaa20e94a9f7116977ed924017fecb1 /libkms/api.c
parent8c0571a73399c372644c8d92a136a474f3e05d48 (diff)
downloadexternal-libdrm-201f5795a26ae7b5580a35b24f4e89e5cd3455b1.tar.gz
external-libdrm-201f5795a26ae7b5580a35b24f4e89e5cd3455b1.tar.xz
external-libdrm-201f5795a26ae7b5580a35b24f4e89e5cd3455b1.zip
libkms: Change destroy api a bit
Diffstat (limited to 'libkms/api.c')
-rw-r--r--libkms/api.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/libkms/api.c b/libkms/api.c
index f15ee70b..6f899c41 100644
--- a/libkms/api.c
+++ b/libkms/api.c
@@ -54,9 +54,13 @@ int kms_get_prop(struct kms_driver *kms, unsigned key, unsigned *out)
54 return kms->get_prop(kms, key, out); 54 return kms->get_prop(kms, key, out);
55} 55}
56 56
57int kms_destroy(struct kms_driver *kms) 57int kms_destroy(struct kms_driver **kms)
58{ 58{
59 free(kms); 59 if (!(*kms))
60 return 0;
61
62 free(*kms);
63 *kms = NULL;
60 return 0; 64 return 0;
61} 65}
62 66
@@ -118,7 +122,17 @@ int kms_bo_unmap(struct kms_bo *bo)
118 return bo->kms->bo_unmap(bo); 122 return bo->kms->bo_unmap(bo);
119} 123}
120 124
121int kms_bo_destroy(struct kms_bo *bo) 125int kms_bo_destroy(struct kms_bo **bo)
122{ 126{
123 return bo->kms->bo_destroy(bo); 127 int ret;
128
129 if (!(*bo))
130 return 0;
131
132 ret = (*bo)->kms->bo_destroy(*bo);
133 if (ret)
134 return ret;
135
136 *bo = NULL;
137 return 0;
124} 138}