From 6af35bd55ba54f34f4ef42e89ed80a9ad3aa3802 Mon Sep 17 00:00:00 2001 From: Lekensteyn Date: Tue, 13 Dec 2011 00:07:30 +0100 Subject: [PATCH] bbswitch: Check for result before deref it --- bbswitch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bbswitch.c b/bbswitch.c index 32dd339..255049c 100644 --- a/bbswitch.c +++ b/bbswitch.c @@ -63,7 +63,9 @@ static int acpi_optimus_dsm(acpi_handle handle, int func, char *args, obj = (union acpi_object *)output.pointer; if (obj->type == ACPI_TYPE_INTEGER) - *result = obj->integer.value; + if (result) + *result = obj->integer.value; + // REVS (revision number) not found, possibly not an Optimus? if (obj->integer.value == 0x80000002) { printk(KERN_INFO "bbswitch: Optimus function not found\n");