From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758724Ab2ECUpl (ORCPT ); Thu, 3 May 2012 16:45:41 -0400 Received: from ogre.sisk.pl ([193.178.161.156]:52178 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758602Ab2ECUpk (ORCPT ); Thu, 3 May 2012 16:45:40 -0400 From: "Rafael J. Wysocki" To: linux-pm@lists.linux-foundation.org Subject: Re: [linux-pm] [PATCHv3 2/5] cpuidle: fix error handling in __cpuidle_register_device Date: Thu, 3 May 2012 22:50:26 +0200 User-Agent: KMail/1.13.6 (Linux/3.4.0-rc5+; KDE/4.6.0; x86_64; ; ) Cc: Colin Cross , linux-kernel@vger.kernel.org, Kevin Hilman , Len Brown , Russell King , "Greg Kroah-Hartman" , Kay Sievers , Amit Kucheria , Arjan van de Ven , Arnd Bergmann , linux-arm-kernel@lists.infradead.org References: <1335816551-27756-1-git-send-email-ccross@android.com> <1335816551-27756-3-git-send-email-ccross@android.com> In-Reply-To: <1335816551-27756-3-git-send-email-ccross@android.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201205032250.26434.rjw@sisk.pl> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday, April 30, 2012, Colin Cross wrote: > 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 > --- > drivers/cpuidle/cpuidle.c | 13 +++++++++---- > 1 files 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; > } > > /** >