video: tegra: host: Check error from channel finish
Terje Bergstrom [Mon, 10 Jun 2013 10:30:04 +0000 (13:30 +0300)]
gk20a_channel_finish() returns an error code. Check the error code.
Currently only unmap can deal with error by refusing to unmap a buffer
when channel refuses to finish.

Bug 1304227

Change-Id: I0d377277cc139cac72636a7da67c80397877ffcc
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/241877
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>

drivers/video/tegra/host/gk20a/channel_gk20a.c
drivers/video/tegra/host/gk20a/mm_gk20a.c

index 8d134df..df1d1c5 100644 (file)
@@ -363,9 +363,12 @@ void gk20a_disable_channel(struct channel_gk20a *ch,
 {
        struct nvhost_device_data *pdata = nvhost_get_devdata(ch->g->dev);
        struct nvhost_master *host = host_from_gk20a_channel(ch);
+       int err;
 
-       if (finish)
-               gk20a_channel_finish(ch, finish_timeout);
+       if (finish) {
+               err = gk20a_channel_finish(ch, finish_timeout);
+               WARN_ON(err);
+       }
 
        /* ensure no fences are pending */
        nvhost_syncpt_set_min_eq_max(&host->syncpt,
index 2bdd42a..635b76c 100644 (file)
@@ -1585,11 +1585,14 @@ static int gk20a_as_unmap_buffer(struct nvhost_as_share *as_share, u64 offset,
                if (likely(!hwctx->has_timedout)) {
                        ch =  (struct channel_gk20a *)hwctx->priv;
                        BUG_ON(!ch);
-                       gk20a_channel_finish(ch, timeout);
+                       err = gk20a_channel_finish(ch, timeout);
+                       if (err)
+                               break;
                }
        }
 
-       vm->unmap_user(vm, offset, memmgr, r);
+       if (!err)
+               vm->unmap_user(vm, offset, memmgr, r);
 
        return err;
 }