From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A546C3F2CD for ; Wed, 4 Mar 2020 10:50:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4295721775 for ; Wed, 4 Mar 2020 10:50:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726583AbgCDKun (ORCPT ); Wed, 4 Mar 2020 05:50:43 -0500 Received: from foss.arm.com ([217.140.110.172]:60826 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726137AbgCDKun (ORCPT ); Wed, 4 Mar 2020 05:50:43 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C0C0030E; Wed, 4 Mar 2020 02:50:42 -0800 (PST) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 553B13F534; Wed, 4 Mar 2020 02:50:41 -0800 (PST) Date: Wed, 4 Mar 2020 10:50:39 +0000 From: Sudeep Holla To: Ulf Hansson Cc: Lorenzo Pieralisi , linux-pm@vger.kernel.org, "Rafael J . Wysocki" , Daniel Lezcano , Lina Iyer , Vincent Guittot , Stephen Boyd , Bjorn Andersson , Benjamin Gaignard , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 2/4] cpuidle: psci: Fixup support for domain idle states being zero Message-ID: <20200304105039.GC25004@bogus> References: <20200303203559.23995-1-ulf.hansson@linaro.org> <20200303203559.23995-3-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200303203559.23995-3-ulf.hansson@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On Tue, Mar 03, 2020 at 09:35:57PM +0100, Ulf Hansson wrote: > The current code intends to allow a PSCI PM domain to have none domain idle > states defined in DT. However, a few minor things needs to be fixed to make > this correctly supported, so let's do that. > > Reported-by: Benjamin Gaignard > Fixes: a65a397f2451 ("cpuidle: psci: Add support for PM domains by using genpd") > Signed-off-by: Ulf Hansson > --- > drivers/cpuidle/cpuidle-psci-domain.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c > index 423f03bbeb74..c34b12c4069a 100644 > --- a/drivers/cpuidle/cpuidle-psci-domain.c > +++ b/drivers/cpuidle/cpuidle-psci-domain.c > @@ -49,6 +49,9 @@ static int __init psci_pd_parse_state_nodes(struct genpd_power_state *states, > int i, ret; > u32 psci_state, *psci_state_buf; > > + if (!states) > + return 0; > + Was any issue found ? Or just code inspection ? If states = NULL, state_count = 0, and I don't see anything blowing up. It may save couple of extra instruction execution. > for (i = 0; i < state_count; i++) { > ret = psci_dt_parse_state_node(to_of_node(states[i].fwnode), > &psci_state); > @@ -96,6 +99,9 @@ static void psci_pd_free_states(struct genpd_power_state *states, > { > int i; > > + if (!states) > + return; > + Same here and kfree(NULL) is also valid. -- Regards, Sudeep