Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752485AbcCYLqQ (ORCPT ); Fri, 25 Mar 2016 07:46:16 -0400 Received: from mail-wm0-f53.google.com ([74.125.82.53]:34079 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751399AbcCYLqO (ORCPT ); Fri, 25 Mar 2016 07:46:14 -0400 Subject: Re: [PATCH 1/2] ARM: cpuidle: fix !cpuidle_ops[cpu].init case during init To: Jisheng Zhang , linux@arm.linux.org.uk References: <1458796269-6158-1-git-send-email-jszhang@marvell.com> <1458796269-6158-2-git-send-email-jszhang@marvell.com> Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org From: Daniel Lezcano Message-ID: <56F52502.3060308@linaro.org> Date: Fri, 25 Mar 2016 12:46:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1458796269-6158-2-git-send-email-jszhang@marvell.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1234 Lines: 37 On 03/24/2016 06:11 AM, Jisheng Zhang wrote: > Let's assume cpuidle_ops exists but it doesn't implement the according > init member, current arm_cpuidle_init() will return success to its > caller, but in fact it should return -EOPNOTSUPP. > > Signed-off-by: Jisheng Zhang > --- > arch/arm/kernel/cpuidle.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/kernel/cpuidle.c b/arch/arm/kernel/cpuidle.c > index 703926e..f108d8f 100644 > --- a/arch/arm/kernel/cpuidle.c > +++ b/arch/arm/kernel/cpuidle.c > @@ -143,8 +143,12 @@ int __init arm_cpuidle_init(int cpu) > return -ENODEV; > > ret = arm_cpuidle_read_ops(cpu_node, cpu); > - if (!ret && cpuidle_ops[cpu].init) > - ret = cpuidle_ops[cpu].init(cpu_node, cpu); > + if (!ret) { > + if (cpuidle_ops[cpu].init) > + ret = cpuidle_ops[cpu].init(cpu_node, cpu); > + else > + ret = -EOPNOTSUPP; > + } Hi Jisheng, this should be handled in the arm_cpuidle_read_ops function. -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog