[PATCH 05/62] dma-buf: Convert dma_buf_import_sync_file() to the early-return style
From: Bart Van Assche
Date: Mon Feb 23 2026 - 17:03:11 EST
From: Bart Van Assche <bvanassche@xxxxxxx>
Before making changes in dma_buf_import_sync_file(), convert it to
the early-return coding style. No functionality has been changed.
Cc: Sumit Semwal <sumit.semwal@xxxxxxxxxx>
Cc: Christian König <christian.koenig@xxxxxxx>
Cc: linux-media@xxxxxxxxxxxxxxx
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
drivers/dma-buf/dma-buf.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 11711874a325..1666133ac8b8 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -523,11 +523,13 @@ static long dma_buf_import_sync_file(struct dma_buf *dmabuf,
dma_resv_lock(dmabuf->resv, NULL);
ret = dma_resv_reserve_fences(dmabuf->resv, num_fences);
- if (!ret) {
- dma_fence_unwrap_for_each(f, &iter, fence)
- dma_resv_add_fence(dmabuf->resv, f, usage);
- }
+ if (ret)
+ goto unlock;
+
+ dma_fence_unwrap_for_each(f, &iter, fence)
+ dma_resv_add_fence(dmabuf->resv, f, usage);
+unlock:
dma_resv_unlock(dmabuf->resv);
}