diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/tsg_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c index aadf5463..e1424f2b 100644 --- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | |||
@@ -156,6 +156,7 @@ int gk20a_tsg_unbind_channel(struct channel_gk20a *ch) | |||
156 | int gk20a_init_tsg_support(struct gk20a *g, u32 tsgid) | 156 | int gk20a_init_tsg_support(struct gk20a *g, u32 tsgid) |
157 | { | 157 | { |
158 | struct tsg_gk20a *tsg = NULL; | 158 | struct tsg_gk20a *tsg = NULL; |
159 | int err; | ||
159 | 160 | ||
160 | if (tsgid >= g->fifo.num_channels) | 161 | if (tsgid >= g->fifo.num_channels) |
161 | return -EINVAL; | 162 | return -EINVAL; |
@@ -169,7 +170,11 @@ int gk20a_init_tsg_support(struct gk20a *g, u32 tsgid) | |||
169 | init_rwsem(&tsg->ch_list_lock); | 170 | init_rwsem(&tsg->ch_list_lock); |
170 | 171 | ||
171 | INIT_LIST_HEAD(&tsg->event_id_list); | 172 | INIT_LIST_HEAD(&tsg->event_id_list); |
172 | nvgpu_mutex_init(&tsg->event_id_list_lock); | 173 | err = nvgpu_mutex_init(&tsg->event_id_list_lock); |
174 | if (err) { | ||
175 | tsg->in_use = true; /* make this TSG unusable */ | ||
176 | return err; | ||
177 | } | ||
173 | 178 | ||
174 | return 0; | 179 | return 0; |
175 | } | 180 | } |
@@ -287,7 +292,10 @@ static int gk20a_tsg_event_id_enable(struct tsg_gk20a *tsg, | |||
287 | event_id_data->event_id = event_id; | 292 | event_id_data->event_id = event_id; |
288 | 293 | ||
289 | init_waitqueue_head(&event_id_data->event_id_wq); | 294 | init_waitqueue_head(&event_id_data->event_id_wq); |
290 | nvgpu_mutex_init(&event_id_data->lock); | 295 | err = nvgpu_mutex_init(&event_id_data->lock); |
296 | if (err) | ||
297 | goto clean_up_free; | ||
298 | |||
291 | INIT_LIST_HEAD(&event_id_data->event_id_node); | 299 | INIT_LIST_HEAD(&event_id_data->event_id_node); |
292 | 300 | ||
293 | nvgpu_mutex_acquire(&tsg->event_id_list_lock); | 301 | nvgpu_mutex_acquire(&tsg->event_id_list_lock); |
@@ -301,6 +309,8 @@ static int gk20a_tsg_event_id_enable(struct tsg_gk20a *tsg, | |||
301 | 309 | ||
302 | return 0; | 310 | return 0; |
303 | 311 | ||
312 | clean_up_free: | ||
313 | kfree(event_id_data); | ||
304 | clean_up_file: | 314 | clean_up_file: |
305 | fput(file); | 315 | fput(file); |
306 | clean_up: | 316 | clean_up: |