From: Karol Wachowski <karol.wachow...@intel.com>

Add one jiffy to ensure wait function never times out before
intended timeout value, which could happen if absolute timeout value
is less than (1s / CONFIG_HZ) in the future.

Signed-off-by: Karol Wachowski <karol.wachow...@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynow...@linux.intel.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynow...@linux.intel.com>
---
 drivers/accel/ivpu/ivpu_gem.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/accel/ivpu/ivpu_gem.c b/drivers/accel/ivpu/ivpu_gem.c
index 1b409dbd332d8..d8e97a760fbc0 100644
--- a/drivers/accel/ivpu/ivpu_gem.c
+++ b/drivers/accel/ivpu/ivpu_gem.c
@@ -384,6 +384,9 @@ int ivpu_bo_wait_ioctl(struct drm_device *dev, void *data, 
struct drm_file *file
 
        timeout = drm_timeout_abs_to_jiffies(args->timeout_ns);
 
+       /* Add 1 jiffy to ensure the wait function never times out before 
intended timeout_ns */
+       timeout += 1;
+
        obj = drm_gem_object_lookup(file, args->handle);
        if (!obj)
                return -EINVAL;
-- 
2.45.1

Reply via email to