[PATCH 1/6] drm/tegra: Fix syncobj_in wait return value check
Mikko Perttunen <[email protected]> Thu, 30 Jul 2026 13:44:41 +0900
| Newsgroups | org.kernel.vger.linux-tegra,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-media |
|---|---|
| Message-ID | <[email protected]> |
dma_fence_wait_timeout() returns the remaining timeout in jiffies on
success, zero on timeout, and a negative error code if interrupted. The
return value was assigned to 'err' and checked as if it were an errno,
the opposite of the correct logic.
Fix the code to use a properly typed variable and check each condition
correctly.
Fixes: 13abe0bb15ce ("drm/tegra: Implement job submission part of new UAPI")
Reported-by: Dan Carpenter <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]/
Signed-off-by: Mikko Perttunen <[email protected]>
---
drivers/gpu/drm/tegra/submit.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/tegra/submit.c b/drivers/gpu/drm/tegra/submit.c
index e5841857c937..5dad6dc4eb8c 100644
--- a/drivers/gpu/drm/tegra/submit.c
+++ b/drivers/gpu/drm/tegra/submit.c
@@ -530,6 +530,7 @@ int tegra_drm_ioctl_channel_submit(struct drm_device *drm, void *data,
if (args->syncobj_in) {
struct dma_fence *fence;
+ long wait_err;
err = drm_syncobj_find_fence(file, args->syncobj_in, 0, 0, &fence);
if (err) {
@@ -537,10 +538,15 @@ int tegra_drm_ioctl_channel_submit(struct drm_device *drm, void *data,
goto unlock;
}
- err = dma_fence_wait_timeout(fence, true, msecs_to_jiffies(10000));
+ wait_err = dma_fence_wait_timeout(fence, true, msecs_to_jiffies(10000));
dma_fence_put(fence);
- if (err) {
+ if (wait_err == 0) {
SUBMIT_ERR(context, "wait for syncobj_in timed out");
+ err = -ETIMEDOUT;
+ goto unlock;
+ } else if (wait_err < 0) {
+ /* In practice, -ERESTARTSYS */
+ err = wait_err;
goto unlock;
}
}
--
2.53.0