summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2015-09-25 20:27:52 +0000
committerkettenis <kettenis@openbsd.org>2015-09-25 20:27:52 +0000
commit5c71444f5e41d4a85602df5a6a9f0deb8a28b0a8 (patch)
treea6bf6d806a36d9cdcd7e67ad149ce911b9535128
parentOutput the contents of the environment in debug mode which is (diff)
downloadwireguard-openbsd-5c71444f5e41d4a85602df5a6a9f0deb8a28b0a8.tar.xz
wireguard-openbsd-5c71444f5e41d4a85602df5a6a9f0deb8a28b0a8.zip
Apparently 0 is not a power of 2 (despite <sys/param.h> claiming that it is).
Fixes inteldrm(4) on the GM45 chipset.
-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)