diff options
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_tsg_t19x.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_tsg_t19x.c b/drivers/gpu/nvgpu/common/linux/ioctl_tsg_t19x.c index b0b1f9c4..87fbf010 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_tsg_t19x.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_tsg_t19x.c | |||
@@ -33,21 +33,26 @@ static int gv11b_tsg_ioctl_bind_channel_ex(struct gk20a *g, | |||
33 | nvgpu_mutex_acquire(&sched->control_lock); | 33 | nvgpu_mutex_acquire(&sched->control_lock); |
34 | if (sched->control_locked) { | 34 | if (sched->control_locked) { |
35 | err = -EPERM; | 35 | err = -EPERM; |
36 | goto done; | 36 | goto mutex_release; |
37 | } | 37 | } |
38 | err = gk20a_busy(g); | 38 | err = gk20a_busy(g); |
39 | if (err) { | 39 | if (err) { |
40 | nvgpu_err(g, "failed to power on gpu"); | 40 | nvgpu_err(g, "failed to power on gpu"); |
41 | goto done; | 41 | goto mutex_release; |
42 | } | 42 | } |
43 | 43 | ||
44 | ch = gk20a_get_channel_from_file(arg->channel_fd); | 44 | ch = gk20a_get_channel_from_file(arg->channel_fd); |
45 | if (!ch) | 45 | if (!ch) { |
46 | return -EINVAL; | 46 | err = -EINVAL; |
47 | if (arg->subcontext_id < g->fifo.t19x.max_subctx_count) | 47 | goto idle; |
48 | } | ||
49 | if (arg->subcontext_id < g->fifo.t19x.max_subctx_count) { | ||
48 | ch->t19x.subctx_id = arg->subcontext_id; | 50 | ch->t19x.subctx_id = arg->subcontext_id; |
49 | else | 51 | } else { |
50 | return -EINVAL; | 52 | err = -EINVAL; |
53 | goto ch_put; | ||
54 | } | ||
55 | |||
51 | nvgpu_log(g, gpu_dbg_info, "channel id : %d : subctx: %d", | 56 | nvgpu_log(g, gpu_dbg_info, "channel id : %d : subctx: %d", |
52 | ch->chid, ch->t19x.subctx_id); | 57 | ch->chid, ch->t19x.subctx_id); |
53 | 58 | ||
@@ -56,8 +61,11 @@ static int gv11b_tsg_ioctl_bind_channel_ex(struct gk20a *g, | |||
56 | ch->t19x.runqueue_sel = 1; | 61 | ch->t19x.runqueue_sel = 1; |
57 | 62 | ||
58 | err = ch->g->ops.fifo.tsg_bind_channel(tsg, ch); | 63 | err = ch->g->ops.fifo.tsg_bind_channel(tsg, ch); |
64 | ch_put: | ||
65 | gk20a_channel_put(ch); | ||
66 | idle: | ||
59 | gk20a_idle(g); | 67 | gk20a_idle(g); |
60 | done: | 68 | mutex_release: |
61 | nvgpu_mutex_release(&sched->control_lock); | 69 | nvgpu_mutex_release(&sched->control_lock); |
62 | return err; | 70 | return err; |
63 | } | 71 | } |