diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c b/drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c index 20209efc..24a76a0b 100644 --- a/drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/nvgpu_allocator.c | |||
@@ -116,6 +116,7 @@ void nvgpu_alloc_release_carveout(struct nvgpu_allocator *a, | |||
116 | void nvgpu_alloc_destroy(struct nvgpu_allocator *a) | 116 | void nvgpu_alloc_destroy(struct nvgpu_allocator *a) |
117 | { | 117 | { |
118 | a->ops->fini(a); | 118 | a->ops->fini(a); |
119 | nvgpu_mutex_destroy(&a->lock); | ||
119 | memset(a, 0, sizeof(*a)); | 120 | memset(a, 0, sizeof(*a)); |
120 | } | 121 | } |
121 | 122 | ||
@@ -126,6 +127,8 @@ int __nvgpu_alloc_common_init(struct nvgpu_allocator *a, | |||
126 | const char *name, void *priv, bool dbg, | 127 | const char *name, void *priv, bool dbg, |
127 | const struct nvgpu_allocator_ops *ops) | 128 | const struct nvgpu_allocator_ops *ops) |
128 | { | 129 | { |
130 | int err; | ||
131 | |||
129 | if (!ops) | 132 | if (!ops) |
130 | return -EINVAL; | 133 | return -EINVAL; |
131 | 134 | ||
@@ -136,12 +139,14 @@ int __nvgpu_alloc_common_init(struct nvgpu_allocator *a, | |||
136 | if (!ops->alloc || !ops->free || !ops->fini) | 139 | if (!ops->alloc || !ops->free || !ops->fini) |
137 | return -EINVAL; | 140 | return -EINVAL; |
138 | 141 | ||
142 | err = nvgpu_mutex_init(&a->lock); | ||
143 | if (err) | ||
144 | return err; | ||
145 | |||
139 | a->ops = ops; | 146 | a->ops = ops; |
140 | a->priv = priv; | 147 | a->priv = priv; |
141 | a->debug = dbg; | 148 | a->debug = dbg; |
142 | 149 | ||
143 | nvgpu_mutex_init(&a->lock); | ||
144 | |||
145 | strlcpy(a->name, name, sizeof(a->name)); | 150 | strlcpy(a->name, name, sizeof(a->name)); |
146 | 151 | ||
147 | return 0; | 152 | return 0; |