summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2015-09-25 20:27:53 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2015-09-25 20:27:53 +0000
commit82d5d5229ce1480e0dc8cd19039676fc6eba9b8a (patch)
tree012cf6c64d010f8da6967b1475615747d3bd87c9 /sys
parentc7c27e189cb11e9180063b785505d68d637a2375 (diff)
Apparently 0 is not a power of 2 (despite <sys/param.h> claiming that it is).
Fixes inteldrm(4) on the GM45 chipset.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/drm_linux.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/drm_linux.h b/sys/dev/pci/drm/drm_linux.h
index 124f54ed58e..e12188455d8 100644
--- a/sys/dev/pci/drm/drm_linux.h
+++ b/sys/dev/pci/drm/drm_linux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_linux.h,v 1.35 2015/09/24 20:52:28 kettenis Exp $ */
+/* $OpenBSD: drm_linux.h,v 1.36 2015/09/25 20:27:52 kettenis Exp $ */
/*
* Copyright (c) 2013, 2014, 2015 Mark Kettenis
*
@@ -1002,7 +1002,7 @@ roundup_pow_of_two(unsigned long x)
return (1UL << flsl(x - 1));
}
-#define is_power_of_2(x) ((((x)-1)&(x))==0)
+#define is_power_of_2(x) (x != 0 && (((x) - 1) & (x)) == 0)
#define PAGE_ALIGN(addr) (((addr) + PAGE_MASK) & ~PAGE_MASK)
#define IS_ALIGNED(x, y) (((x) & ((y) - 1)) == 0)