drm/etnaviv: don't put fence in case of submit failure
authorLucas Stach <l.stach@pengutronix.de>
Fri, 28 Apr 2017 15:30:52 +0000 (17:30 +0200)
committerLucas Stach <l.stach@pengutronix.de>
Fri, 5 May 2017 15:12:34 +0000 (17:12 +0200)
If we bail out of the submit before actually adding the cmdstream
to the kernel ring there is no valid fence to put. Make sure to skip
the fence_put in that case.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c

index e1909429837eebc2072d00d9a9f590c6e5f87bd2..de80ee1b71dfa2e8380b6e74b2d8cc6ed4aa6f25 100644 (file)
@@ -44,6 +44,7 @@ static struct etnaviv_gem_submit *submit_create(struct drm_device *dev,
 
                /* initially, until copy_from_user() and bo lookup succeeds: */
                submit->nr_bos = 0;
+               submit->fence = NULL;
 
                ww_acquire_init(&submit->ticket, &reservation_ww_class);
        }
@@ -294,7 +295,8 @@ static void submit_cleanup(struct etnaviv_gem_submit *submit)
        }
 
        ww_acquire_fini(&submit->ticket);
-       dma_fence_put(submit->fence);
+       if (submit->fence)
+               dma_fence_put(submit->fence);
        kfree(submit);
 }