panfrost: Fix BO reference counting
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 28 Apr 2020 19:28:11 +0000 (15:28 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Apr 2020 15:18:38 +0000 (15:18 +0000)
Typo.

Fixes: 3283c7f4dad ("panfrost: Inline reference counting routines")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4792>

src/panfrost/encoder/pan_bo.c

index 9e5ea7ed21e2708812ad2500914a4a68233a2c3b..32fc84e13637b81cd82143d2548c4ef0a24b346f 100644 (file)
@@ -482,7 +482,7 @@ panfrost_bo_import(struct panfrost_device *dev, int fd)
                 panfrost_bo_mmap(newbo);
         } else {
                 ralloc_free(newbo);
-                /* bo->refcnt != 0 can happen if the BO
+                /* bo->refcnt == 0 can happen if the BO
                  * was being released but panfrost_bo_import() acquired the
                  * lock before panfrost_bo_unreference(). In that case, refcnt
                  * is 0 and we can't use panfrost_bo_reference() directly, we
@@ -492,7 +492,7 @@ panfrost_bo_import(struct panfrost_device *dev, int fd)
                  * make sure the object is not freed if panfrost_bo_import()
                  * acquired it in the meantime.
                  */
-                if (p_atomic_read(&bo->refcnt))
+                if (p_atomic_read(&bo->refcnt) == 0)
                         p_atomic_set(&newbo->refcnt, 1);
                 else
                         panfrost_bo_reference(bo);