Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755515Ab2FZJPM (ORCPT ); Tue, 26 Jun 2012 05:15:12 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:4562 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1754261Ab2FZJPI (ORCPT ); Tue, 26 Jun 2012 05:15:08 -0400 X-IronPort-AV: E=Sophos;i="4.77,476,1336320000"; d="scan'208";a="5266043" Message-ID: <4FE97EA5.9010904@cn.fujitsu.com> Date: Tue, 26 Jun 2012 17:19:33 +0800 From: Wen Congyang User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100413 Fedora/3.0.4-2.fc13 Thunderbird/3.0.4 MIME-Version: 1.0 To: lenb@kernel.org, linux-acpi@vger.kernel.org, "linux-kernel@vger.kernel.org" CC: Yasuaki ISIMATU Subject: [PATCH 2/8] free memory device if acpi_memory_enable_device() failed References: <4FE97DD5.6030205@cn.fujitsu.com> In-Reply-To: <4FE97DD5.6030205@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/06/26 17:15:19, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/06/26 17:15:20, Serialize complete at 2012/06/26 17:15:20 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1205 Lines: 35 If acpi_memory_enable_device() fails, acpi_memory_enable_device() will return a non-zero value, which means we fail to bind the memory device to this driver. So we should free memory device before acpi_memory_device_add() returns. Signed-off-by: Wen Congyang --- drivers/acpi/acpi_memhotplug.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index f6831d1..bb7bc66 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -454,9 +454,11 @@ static int acpi_memory_device_add(struct acpi_device *device) if (!acpi_memory_check_device(mem_device)) { /* call add_memory func */ result = acpi_memory_enable_device(mem_device); - if (result) + if (result) { printk(KERN_ERR PREFIX "Error in acpi_memory_enable_device\n"); + acpi_free_memory_device(mem_device); + } } return result; } -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/