From patchwork Sun Sep 13 10:28:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Jenkins X-Patchwork-Id: 47141 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8DASYn1029551 for ; Sun, 13 Sep 2009 10:28:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752570AbZIMK2a (ORCPT ); Sun, 13 Sep 2009 06:28:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752660AbZIMK2a (ORCPT ); Sun, 13 Sep 2009 06:28:30 -0400 Received: from mail-ew0-f206.google.com ([209.85.219.206]:33728 "EHLO mail-ew0-f206.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752570AbZIMK23 (ORCPT ); Sun, 13 Sep 2009 06:28:29 -0400 Received: by ewy2 with SMTP id 2so2202156ewy.17 for ; Sun, 13 Sep 2009 03:28:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:content-type :content-transfer-encoding; bh=JX/Z/3EqPR9df+XctNjsvInDtKQtCJZ1KEQtUNDtBfE=; b=leR2tACFsCYOGaW7xE0WQplOcq4keC4qyDpXjn6dxQov+1yPzgtInNV8IjiJAZGBUS ZYEcEFQ4zY0XtdbY7YbBTi1SIA+DG+IkuhrX3rOu4VaE071BNnFRMkgTpwEbhd5sq+Ea f1xCdK8waYfBGAKhBvawLm5fo5yarOZRGSDwI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; b=xQr2snNGM95AqxrRnDzldIfZBufMdVDQ3RVzoU2FiphMtMWS/i6lWQvK75xHYBaGYy jUH/muIzw0lFfa2DXWiPutKhwEsfb+Txpplw8xHw4C9xNo3eO7LtvnLSbVS18rBKbZ4q AqxJq3G/OEYPMSQwSvVDmlnyhYGoHzddi4mQ8= Received: by 10.211.130.19 with SMTP id h19mr5645165ebn.54.1252837711934; Sun, 13 Sep 2009 03:28:31 -0700 (PDT) Received: from ?192.168.0.5? ([86.53.68.233]) by mx.google.com with ESMTPS id 10sm5163600eyd.7.2009.09.13.03.28.31 (version=SSLv3 cipher=RC4-MD5); Sun, 13 Sep 2009 03:28:31 -0700 (PDT) Message-ID: <4AACC94E.9040208@tuffmail.co.uk> Date: Sun, 13 Sep 2009 11:28:30 +0100 From: Alan Jenkins User-Agent: Thunderbird 2.0.0.21 (X11/20090318) MIME-Version: 1.0 To: Zhang Rui CC: linux acpi Subject: [PATCH] ACPI fan: fix memleak on acpi_fan_add_fs() failure Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Signed-off-by: Alan Jenkins --- drivers/acpi/fan.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 947556e..eb1511e 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c @@ -283,13 +283,17 @@ static int acpi_fan_add(struct acpi_device *device) result = acpi_fan_add_fs(device); if (result) - goto end; + goto unregister; printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device), acpi_device_bid(device), !device->power.state ? "on" : "off"); - end: +unregister: + sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); + sysfs_remove_link(&cdev->device.kobj, "device"); + thermal_cooling_device_unregister(cdev); +end: return result; }