From patchwork Wed Jul 25 03:41:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 1235121 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 3DC013FD4F for ; Wed, 25 Jul 2012 03:52:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932778Ab2GYDmf (ORCPT ); Tue, 24 Jul 2012 23:42:35 -0400 Received: from mail-qa0-f53.google.com ([209.85.216.53]:52413 "EHLO mail-qa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932714Ab2GYDmc (ORCPT ); Tue, 24 Jul 2012 23:42:32 -0400 Received: by mail-qa0-f53.google.com with SMTP id s11so247432qaa.19 for ; Tue, 24 Jul 2012 20:42:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:in-reply-to:references:reply-to:organization; bh=Wg24qLSz+oMFlWg7mS/yk83O7Cw3CKrgdLMG+8GtEMI=; b=dl12LspgcVZCRMo4kKQVEBpXsz6s5jP8iDTdNw9EffHIs4+gO4gI0C4WaoFoelBC2a lQKAyFa2+1HM6n9WQNAHgZ+LcJftAcjztIVgwNMsdMByfq97JKpXnVhdMe5G1zehbz/B I8zu0SXTrc+er4nPkXGmQoLcuphppMk+71CqphlLkhTOGbjRI05qcsrVojTJlHLAibGy bdwaIMrtLu77BkYJEa54iBwbAoi8UfN44TyG7UYBS4k9TYiGZSXfCLzv+4ddGSL/O5Kp M6vKiFk88qIrAZC91Rob1XyS2YjzcMwF7DaxAgLftyRwywfQkBfbnUpq4G0AyUivCI88 FZhA== Received: by 10.224.193.73 with SMTP id dt9mr3122329qab.49.1343187751871; Tue, 24 Jul 2012 20:42:31 -0700 (PDT) Received: from x980.localdomain6 (h184-61-125-197.altnnh.dsl.dynamic.tds.net. [184.61.125.197]) by mx.google.com with ESMTPS id et6sm15489186qab.8.2012.07.24.20.42.29 (version=SSLv3 cipher=OTHER); Tue, 24 Jul 2012 20:42:30 -0700 (PDT) From: Len Brown To: linux-acpi@vger.kernel.org, linux-pm@lists.linux-foundation.org Cc: linux-kernel@vger.kernel.org, Colin Cross , Len Brown Subject: [PATCH 16/52] cpuidle: fix error handling in __cpuidle_register_device Date: Tue, 24 Jul 2012 23:41:12 -0400 Message-Id: <3af272ab75c7a0c7fa5ae5507724d961f7e7718b.1343187617.git.len.brown@intel.com> X-Mailer: git-send-email 1.7.12.rc0 In-Reply-To: <1343187708-19532-1-git-send-email-lenb@kernel.org> References: <1343187708-19532-1-git-send-email-lenb@kernel.org> In-Reply-To: <6af1c4fc5227af65092ebc848989693562bfa3e8.1343187617.git.len.brown@intel.com> References: <6af1c4fc5227af65092ebc848989693562bfa3e8.1343187617.git.len.brown@intel.com> Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Colin Cross Fix the error handling in __cpuidle_register_device to include the missing list_del. Move it to a label, which will simplify the error handling when coupled states are added. Reviewed-by: Santosh Shilimkar Tested-by: Santosh Shilimkar Reviewed-by: Kevin Hilman Tested-by: Kevin Hilman Signed-off-by: Colin Cross Reviewed-by: Rafael J. Wysocki Signed-off-by: Len Brown --- drivers/cpuidle/cpuidle.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 3e3e3e4..4540672 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -403,13 +403,18 @@ static int __cpuidle_register_device(struct cpuidle_device *dev) per_cpu(cpuidle_devices, dev->cpu) = dev; list_add(&dev->device_list, &cpuidle_detected_devices); - if ((ret = cpuidle_add_sysfs(cpu_dev))) { - module_put(cpuidle_driver->owner); - return ret; - } + ret = cpuidle_add_sysfs(cpu_dev); + if (ret) + goto err_sysfs; dev->registered = 1; return 0; + +err_sysfs: + list_del(&dev->device_list); + per_cpu(cpuidle_devices, dev->cpu) = NULL; + module_put(cpuidle_driver->owner); + return ret; } /**