etnaviv: fix a null pointer dereference
authorAndrii Simiklit <andrii.simiklit@globallogic.com>
Fri, 19 Jul 2019 14:39:07 +0000 (17:39 +0300)
committerLucas Stach <l.stach@pengutronix.de>
Mon, 5 Aug 2019 13:31:43 +0000 (15:31 +0200)
This issue was found by cppcheck

Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
src/etnaviv/drm/etnaviv_bo.c

index 6e952fa478582bc58b3faf00214dfdbc00489bec..2b1fbbbc3c7f86fc66cc63b219cd878fb2c1a282 100644 (file)
@@ -238,11 +238,11 @@ out_unlock:
 /* destroy a buffer object */
 void etna_bo_del(struct etna_bo *bo)
 {
-       struct etna_device *dev = bo->dev;
-
        if (!bo)
                return;
 
+       struct etna_device *dev = bo->dev;
+
        if (!p_atomic_dec_zero(&bo->refcnt))
                return;