platform/x86: wmi: Fix error handling when creating devices
authorAndy Lutomirski <luto@kernel.org>
Wed, 25 Nov 2015 16:24:42 +0000 (08:24 -0800)
committerDarren Hart (VMware) <dvhart@infradead.org>
Tue, 6 Jun 2017 17:15:18 +0000 (10:15 -0700)
commita1c31bcd5772b13b39b028126fa9de918c36cf26
treed00d06de011ba692119731a7cf68e7edd4bf7065
parent844af950da946cfab227a04b950614da04cb6275
platform/x86: wmi: Fix error handling when creating devices

We have two memory leaks. If guid_already_parsed returned true, we leak
the wmi_block. If wmi_create_device failed, we leak the device.

Simplify the logic and fix both of them.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Mario Limonciello <mario_limonciello@dell.com>
Cc: Pali Rohár <pali.rohar@gmail.com>
Cc: linux-kernel@vger.kernel.org
Cc: platform-driver-x86@vger.kernel.org
Cc: linux-acpi@vger.kernel.org
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
drivers/platform/x86/wmi.c