diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index 99d5fd4c2..1818a57ea 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c @@ -486,9 +486,24 @@ void gk20a_fifo_delete_runlist(struct fifo_gk20a *f) static void gk20a_remove_fifo_support(struct fifo_gk20a *f) { struct gk20a *g = f->g; + unsigned int i = 0; gk20a_dbg_fn(""); + /* + * Make sure all channels are closed before deleting them. + */ + for (; i < f->num_channels; i++) { + struct channel_gk20a *c = f->channel + i; + + /* + * Could race but worst that happens is we get an error message + * from gk20a_free_channel() complaining about multiple closes. + */ + if (c->referenceable) + __gk20a_channel_kill(c); + } + vfree(f->channel); vfree(f->tsg); if (g->ops.mm.is_bar1_supported(g))