Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754336Ab3IYVto (ORCPT ); Wed, 25 Sep 2013 17:49:44 -0400 Received: from mail-we0-f179.google.com ([74.125.82.179]:34423 "EHLO mail-we0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751278Ab3IYVtn (ORCPT ); Wed, 25 Sep 2013 17:49:43 -0400 Message-ID: <52435A74.3060808@linaro.org> Date: Wed, 25 Sep 2013 23:49:40 +0200 From: Daniel Lezcano User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Viresh Kumar , rjw@sisk.pl CC: linaro-kernel@lists.linaro.org, patches@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 07/21] cpuidle: rearrange __cpuidle_register_device() to keep minimal exit points References: <2dd257d9843954aaaf0cf30c7fb475daded018a5.1379779777.git.viresh.kumar@linaro.org> In-Reply-To: <2dd257d9843954aaaf0cf30c7fb475daded018a5.1379779777.git.viresh.kumar@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1532 Lines: 47 On 09/22/2013 03:20 AM, Viresh Kumar wrote: > This patch rearranges __cpuidle_register_device() a bit in order to reduce the > number of exit points of this function. > > Signed-off-by: Viresh Kumar > --- > drivers/cpuidle/cpuidle.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c > index 211e504..8c91bad 100644 > --- a/drivers/cpuidle/cpuidle.c > +++ b/drivers/cpuidle/cpuidle.c > @@ -383,13 +383,12 @@ static int __cpuidle_register_device(struct cpuidle_device *dev) > list_add(&dev->device_list, &cpuidle_detected_devices); > > ret = cpuidle_coupled_register_device(dev); > - if (ret) { > + if (ret) > __cpuidle_unregister_device(dev); > - return ret; > - } > + else > + dev->registered = 1; > > - dev->registered = 1; > - return 0; > + return ret; > } There is no accounting for taste :) I agree the patch concentrates more the return statement into a single place which conforms better to the kernel coding style. -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- 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/