summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/drm/drm_linux.c
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2019-05-10 18:35:00 +0000
committerkettenis <kettenis@openbsd.org>2019-05-10 18:35:00 +0000
commit23c0d2a57d3f7f63ee5b5af3077bc06305d442c7 (patch)
treedf8e5bb2658cbd0075895938939d7b2569c25392 /sys/dev/pci/drm/drm_linux.c
parentOn the transmit path the ethernet and ip headers might not be (diff)
downloadwireguard-openbsd-23c0d2a57d3f7f63ee5b5af3077bc06305d442c7.tar.xz
wireguard-openbsd-23c0d2a57d3f7f63ee5b5af3077bc06305d442c7.zip
Fix idr_get_next() such that idr_for_each_entry() actually works.
ok jsg@
Diffstat (limited to 'sys/dev/pci/drm/drm_linux.c')
-rw-r--r--sys/dev/pci/drm/drm_linux.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c
index f64e3dd4a64..88e4b9265b0 100644
--- a/sys/dev/pci/drm/drm_linux.c
+++ b/sys/dev/pci/drm/drm_linux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_linux.c,v 1.34 2019/04/23 11:38:55 jsg Exp $ */
+/* $OpenBSD: drm_linux.c,v 1.35 2019/05/10 18:35:00 kettenis Exp $ */
/*
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
@@ -571,15 +571,14 @@ idr_get_next(struct idr *idr, int *id)
{
struct idr_entry *res;
- res = idr_find(idr, *id);
- if (res == NULL)
- res = SPLAY_MIN(idr_tree, &idr->tree);
- else
- res = SPLAY_NEXT(idr_tree, &idr->tree, res);
- if (res == NULL)
- return NULL;
- *id = res->id;
- return res->ptr;
+ SPLAY_FOREACH(res, idr_tree, &idr->tree) {
+ if (res->id >= *id) {
+ *id = res->id;
+ return res->ptr;
+ }
+ }
+
+ return NULL;
}
int