Module Name: src Committed By: riastradh Date: Sun Dec 19 12:26:39 UTC 2021
Modified Files: src/sys/external/bsd/drm2/linux: linux_dma_resv.c Log Message: drm: Factor dma_fence_put out of multiple dma_resv_do_poll branches. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/drm2/linux/linux_dma_resv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/drm2/linux/linux_dma_resv.c diff -u src/sys/external/bsd/drm2/linux/linux_dma_resv.c:1.15 src/sys/external/bsd/drm2/linux/linux_dma_resv.c:1.16 --- src/sys/external/bsd/drm2/linux/linux_dma_resv.c:1.15 Sun Dec 19 12:26:30 2021 +++ src/sys/external/bsd/drm2/linux/linux_dma_resv.c Sun Dec 19 12:26:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_dma_resv.c,v 1.15 2021/12/19 12:26:30 riastradh Exp $ */ +/* $NetBSD: linux_dma_resv.c,v 1.16 2021/12/19 12:26:39 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_dma_resv.c,v 1.15 2021/12/19 12:26:30 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_dma_resv.c,v 1.16 2021/12/19 12:26:39 riastradh Exp $"); #include <sys/param.h> #include <sys/poll.h> @@ -1350,11 +1350,8 @@ top: KASSERT(fence == NULL); * Test whether it is signalled. If not, stop and * request a callback. */ - if (dma_fence_is_signaled(fence)) { - dma_fence_put(fence); - fence = NULL; + if (dma_fence_is_signaled(fence)) break; - } /* Put ourselves on the selq if we haven't already. */ if (!recorded) { @@ -1369,8 +1366,6 @@ top: KASSERT(fence == NULL); * assume the event is not ready. */ if (!claimed || callback) { - dma_fence_put(fence); - fence = NULL; revents = 0; break; } @@ -1383,16 +1378,15 @@ top: KASSERT(fence == NULL); */ if (!dma_fence_add_callback(fence, &rpoll->rp_fcb, dma_resv_poll_cb)) { - dma_fence_put(fence); - fence = NULL; revents = 0; callback = true; break; } + } while (0); + if (fence != NULL) { dma_fence_put(fence); fence = NULL; - } while (0); - KASSERT(fence == NULL); + } /* All done reading the fences. */ rcu_read_unlock();