summaryrefslogtreecommitdiffstats
path: root/include/acpi
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2018-01-24 15:42:30 -0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-02-04 08:58:31 +0100
commit761f0b82393353507930b6721ae4311a9df2ca36 (patch)
tree44e5138751d101dc6f8eabca6bd3d8132dfc35a1 /include/acpi
parent0eedae8e5f983aba6fb5c29c8699ecf03c7e50e0 (diff)
downloadlinux-761f0b82393353507930b6721ae4311a9df2ca36.tar.gz
linux-761f0b82393353507930b6721ae4311a9df2ca36.tar.bz2
linux-761f0b82393353507930b6721ae4311a9df2ca36.zip
ACPICA: Avoid NULL pointer arithmetic
We should not assume NULL is defined as "(void *)0" because NULL is an implementation-defined macro. Especially, Clang 6 complains about it, i.e., "arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension". Signed-off-by: Jung-uk Kim <jkim@free_BSD.org> Signed-off-by: Erik Schmauss <erik.schmauss@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/acpi')
-rw-r--r--include/acpi/actypes.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 31f1be74dd16..f3999ae7a43f 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -485,7 +485,7 @@ typedef u8 acpi_owner_id;
/*
* Constants with special meanings
*/
-#define ACPI_ROOT_OBJECT ACPI_ADD_PTR (acpi_handle, NULL, ACPI_MAX_PTR)
+#define ACPI_ROOT_OBJECT ACPI_ADD_PTR (acpi_handle, (void *) 0, ACPI_MAX_PTR)
#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */
#define ACPI_DO_NOT_WAIT 0
@@ -536,9 +536,9 @@ typedef u64 acpi_integer;
/* Pointer/Integer type conversions */
-#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL,(acpi_size) i)
-#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL)
-#define ACPI_OFFSET(d, f) ACPI_PTR_DIFF (&(((d *) 0)->f), (void *) NULL)
+#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) 0, (acpi_size) (i))
+#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) 0)
+#define ACPI_OFFSET(d, f) ACPI_PTR_DIFF (&(((d *) 0)->f), (void *) 0)
#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)