diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-06-22 13:38:48 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-06-22 13:38:48 +0000 |
commit | a69588b7cc67a5488d3233f96d14e2abc571868b (patch) | |
tree | 2fefa1934b0d395b5722a9c4e554e8315fd06f57 /sys/dev | |
parent | 5b17094a32f5478ff42214a5d4a371630a20b4d2 (diff) |
don't try to decrement if completion flag is UINT_MAX
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/drm/include/linux/completion.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/dev/pci/drm/include/linux/completion.h b/sys/dev/pci/drm/include/linux/completion.h index 0859221262e..f7f883270fc 100644 --- a/sys/dev/pci/drm/include/linux/completion.h +++ b/sys/dev/pci/drm/include/linux/completion.h @@ -1,4 +1,4 @@ -/* $OpenBSD: completion.h,v 1.7 2020/06/22 05:19:26 jsg Exp $ */ +/* $OpenBSD: completion.h,v 1.8 2020/06/22 13:38:47 jsg Exp $ */ /* * Copyright (c) 2015, 2018 Mark Kettenis * @@ -57,7 +57,8 @@ wait_for_completion_timeout(struct completion *x, u_long timo) return 0; } } - x->done--; + if (x->done != UINT_MAX) + x->done--; mtx_leave(&x->wait.lock); return 1; @@ -72,7 +73,8 @@ wait_for_completion(struct completion *x) while (x->done == 0) { msleep_nsec(x, &x->wait.lock, 0, "wfcom", INFSLP); } - x->done--; + if (x->done != UINT_MAX) + x->done--; mtx_leave(&x->wait.lock); } @@ -93,7 +95,8 @@ wait_for_completion_interruptible(struct completion *x) return -ERESTARTSYS; } } - x->done--; + if (x->done != UINT_MAX) + x->done--; mtx_leave(&x->wait.lock); return 0; @@ -116,7 +119,8 @@ wait_for_completion_interruptible_timeout(struct completion *x, u_long timo) return -ERESTARTSYS; } } - x->done--; + if (x->done != UINT_MAX) + x->done--; mtx_leave(&x->wait.lock); return 1; @@ -149,7 +153,8 @@ try_wait_for_completion(struct completion *x) mtx_leave(&x->wait.lock); return false; } - x->done--; + if (x->done != UINT_MAX) + x->done--; mtx_leave(&x->wait.lock); return true; } |