>From fcf93a0a34fea5df219e579341c3a45aa3e90b8f Mon Sep 17 00:00:00 2001 From: Zhang Rui <rui.zhang@xxxxxxxxx> Date: Tue, 15 Jan 2013 09:05:23 +0800 Subject: [PATCH] acer-wmi: fix a problem that variable 'devices' may be used uninitialized drivers/platform/x86/acer-wmi.c: In function ‘acer_wmi_init’: drivers/platform/x86/acer-wmi.c:1216:14: warning: ‘devices’ may be used uninitialized in this function [-Wuninitialized] drivers/platform/x86/acer-wmi.c:1193:6: note: ‘devices’ was declared here In WMID_set_capabilities(), 'devices' will be used uninitialized if the returned object is neither a buffer nor an integer. Signed-off-by: Zhang Rui <rui.zhang@xxxxxxxxx> --- drivers/platform/x86/acer-wmi.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index afed701..c471ad4 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1197,14 +1197,13 @@ static acpi_status WMID_set_capabilities(void) return status; obj = (union acpi_object *) out.pointer; - if (obj) { - if (obj->type == ACPI_TYPE_BUFFER && - (obj->buffer.length == sizeof(u32) || - obj->buffer.length == sizeof(u64))) { - devices = *((u32 *) obj->buffer.pointer); - } else if (obj->type == ACPI_TYPE_INTEGER) { - devices = (u32) obj->integer.value; - } + + if (obj && obj->type == ACPI_TYPE_BUFFER && + (obj->buffer.length == sizeof(u32) || + obj->buffer.length == sizeof(u64))) { + devices = *((u32 *) obj->buffer.pointer); + } else if (obj && obj->type == ACPI_TYPE_INTEGER) { + devices = (u32) obj->integer.value; } else { kfree(out.pointer); return AE_ERROR; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html