From patchwork Fri Apr 15 17:38:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: durgadoss.r@intel.com X-Patchwork-Id: 710681 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3FC5dxr007147 for ; Fri, 15 Apr 2011 12:05:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754491Ab1DOMFX (ORCPT ); Fri, 15 Apr 2011 08:05:23 -0400 Received: from mga09.intel.com ([134.134.136.24]:11625 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754285Ab1DOME7 (ORCPT ); Fri, 15 Apr 2011 08:04:59 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 15 Apr 2011 05:04:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.64,218,1301900400"; d="scan'208";a="629190959" Received: from sgopal1-desktop (HELO localhost.localdomain) ([10.223.96.62]) by orsmga002.jf.intel.com with ESMTP; 15 Apr 2011 05:04:57 -0700 From: Durgadoss R To: lenb@kernel.org, rui.zhang@intel.com Cc: linux-acpi@vger.kernel.org, Durgadoss R Subject: PATCH[1/1]:Fix goto flows in thermal_hwmon_add_sysfs Date: Fri, 15 Apr 2011 23:08:17 +0530 Message-Id: <1302889097-26548-1-git-send-email-durgadoss.r@intel.com> X-Mailer: git-send-email 1.6.1 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 15 Apr 2011 12:05:40 +0000 (UTC) This patch fixes the flow of goto in thermal_hwmon_add_sysfs method in thermal_sys.c Signed-off-by: Durgadoss R --- drivers/thermal/thermal_sys.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index fc6f2a5..bc74c42 100644 --- a/drivers/thermal/thermal_sys.c +++ b/drivers/thermal/thermal_sys.c @@ -513,7 +513,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) sysfs_attr_init(&tz->temp_input.attr.attr); result = device_create_file(hwmon->device, &tz->temp_input.attr); if (result) - goto unregister_hwmon_device; + goto unregister_name; if (tz->ops->get_crit_temp) { unsigned long temperature; @@ -527,7 +527,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) result = device_create_file(hwmon->device, &tz->temp_crit.attr); if (result) - goto unregister_hwmon_device; + goto unregister_input; } } @@ -539,13 +539,14 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) return 0; - unregister_hwmon_device: - device_remove_file(hwmon->device, &tz->temp_crit.attr); + unregister_input: device_remove_file(hwmon->device, &tz->temp_input.attr); - if (new_hwmon_device) { + unregister_name: + if (new_hwmon_device) device_remove_file(hwmon->device, &dev_attr_name); + unregister_hwmon_device: + if (new_hwmon_device) hwmon_device_unregister(hwmon->device); - } free_mem: if (new_hwmon_device) kfree(hwmon);