From mboxrd@z Thu Jan 1 00:00:00 1970 From: Subject: RE: [PATCH v7 12/14] cpufreq: Add Kryo CPU scaling driver Date: Thu, 17 May 2018 10:50:34 +0300 Message-ID: <017601d3edb3$c0d96d40$428c47c0$@codeaurora.org> References: <1526375616-16904-1-git-send-email-ilialin@codeaurora.org> <1526375616-16904-13-git-send-email-ilialin@codeaurora.org> <20180516141132.aqjif7d5motmmnlo@vireshk-i7> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20180516141132.aqjif7d5motmmnlo@vireshk-i7> Content-Language: en-us Sender: linux-kernel-owner@vger.kernel.org To: 'Viresh Kumar' , 'Amit Kucheria' Cc: 'Michael Turquette' , sboyd@kernel.org, 'Rob Herring' , 'Mark Rutland' , nm@ti.com, lgirdwood@gmail.com, broonie@kernel.org, 'Andy Gross' , 'David Brown' , catalin.marinas@arm.com, will.deacon@arm.com, "'Rafael J. Wysocki'" , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, 'LKML' , 'Linux PM list' , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, 'lakml' , 'Rajendra Nayak' , nicolas.dechesne@linaro.org, celster@codeaurora.org, tfinkel@codeaurora.org List-Id: linux-arm-msm@vger.kernel.org > -----Original Message----- > From: Viresh Kumar > Sent: Wednesday, May 16, 2018 17:12 > To: Amit Kucheria > Cc: Ilia Lin ; Michael Turquette > ; sboyd@kernel.org; Rob Herring > ; Mark Rutland ; nm@ti.com; > lgirdwood@gmail.com; broonie@kernel.org; Andy Gross > ; David Brown ; > catalin.marinas@arm.com; will.deacon@arm.com; Rafael J. Wysocki > ; linux-clk@vger.kernel.org; > devicetree@vger.kernel.org; LKML ; Linux > PM list ; linux-arm-msm@vger.kernel.org; linux- > soc@vger.kernel.org; lakml ; > Rajendra Nayak ; nicolas.dechesne@linaro.org; > celster@codeaurora.org; tfinkel@codeaurora.org > Subject: Re: [PATCH v7 12/14] cpufreq: Add Kryo CPU scaling driver > > On 16-05-18, 16:12, Amit Kucheria wrote: > > > + ret = PTR_ERR_OR_ZERO(opp_temp = > > > + > dev_pm_opp_set_supported_hw(cpu_dev,&versions,1)); > > > + if (0 > ret) > > > > Any particular reason to prefer this over (ret < 0) that is generally > > used? I've seen it used to avoid the == vs. = typos, but not for other > > comparisons. > > > > Suggest sticking to what is commonly used i.e. ret < 0. > > > > > + goto free_opp; > > > + > > > + cpu_dev = get_cpu_device(GOLD_LEAD); > > > > Error check cpu_dev here? > > > > > + ret = PTR_ERR_OR_ZERO(opp_temp = > > > + > dev_pm_opp_set_supported_hw(cpu_dev,&versions,1)); > > > + if (0 > ret) > > > + goto free_opp; > > The goto here is wrong If we are here, then the first dev_pm_opp_set_supported_hw() succeeded. And should be deallocated before exit with error. > > > > + > > > + > > > + ret = > PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt", > > > + -1, > > > + NULL, 0)); > > > + > > > + if (0 == ret) > > > + return 0; > > > + > > > +free_opp: > > > + dev_pm_opp_put_supported_hw(opp_temp); > > > > This is not needed because dev_pm_opp_set_supported_hw will free > > memory in case of failure. This call in only needed in case of a > > successful get. > > But this is still required for the case where platform device registration fails. > > -- > viresh From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752337AbeEQHvL (ORCPT ); Thu, 17 May 2018 03:51:11 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:36092 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751680AbeEQHvH (ORCPT ); Thu, 17 May 2018 03:51:07 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5481F60274 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ilialin@codeaurora.org From: To: "'Viresh Kumar'" , "'Amit Kucheria'" Cc: "'Michael Turquette'" , , "'Rob Herring'" , "'Mark Rutland'" , , , , "'Andy Gross'" , "'David Brown'" , , , "'Rafael J. Wysocki'" , , , "'LKML'" , "'Linux PM list'" , , , "'lakml'" , "'Rajendra Nayak'" , , , References: <1526375616-16904-1-git-send-email-ilialin@codeaurora.org> <1526375616-16904-13-git-send-email-ilialin@codeaurora.org> <20180516141132.aqjif7d5motmmnlo@vireshk-i7> In-Reply-To: <20180516141132.aqjif7d5motmmnlo@vireshk-i7> Subject: RE: [PATCH v7 12/14] cpufreq: Add Kryo CPU scaling driver Date: Thu, 17 May 2018 10:50:34 +0300 Message-ID: <017601d3edb3$c0d96d40$428c47c0$@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQGnp1nyG6UZbI+UZ9yYhcbjWitfQAKeDSLwAZ7sm4kCZbuURqRXAqOQ Content-Language: en-us Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Viresh Kumar > Sent: Wednesday, May 16, 2018 17:12 > To: Amit Kucheria > Cc: Ilia Lin ; Michael Turquette > ; sboyd@kernel.org; Rob Herring > ; Mark Rutland ; nm@ti.com; > lgirdwood@gmail.com; broonie@kernel.org; Andy Gross > ; David Brown ; > catalin.marinas@arm.com; will.deacon@arm.com; Rafael J. Wysocki > ; linux-clk@vger.kernel.org; > devicetree@vger.kernel.org; LKML ; Linux > PM list ; linux-arm-msm@vger.kernel.org; linux- > soc@vger.kernel.org; lakml ; > Rajendra Nayak ; nicolas.dechesne@linaro.org; > celster@codeaurora.org; tfinkel@codeaurora.org > Subject: Re: [PATCH v7 12/14] cpufreq: Add Kryo CPU scaling driver > > On 16-05-18, 16:12, Amit Kucheria wrote: > > > + ret = PTR_ERR_OR_ZERO(opp_temp = > > > + > dev_pm_opp_set_supported_hw(cpu_dev,&versions,1)); > > > + if (0 > ret) > > > > Any particular reason to prefer this over (ret < 0) that is generally > > used? I've seen it used to avoid the == vs. = typos, but not for other > > comparisons. > > > > Suggest sticking to what is commonly used i.e. ret < 0. > > > > > + goto free_opp; > > > + > > > + cpu_dev = get_cpu_device(GOLD_LEAD); > > > > Error check cpu_dev here? > > > > > + ret = PTR_ERR_OR_ZERO(opp_temp = > > > + > dev_pm_opp_set_supported_hw(cpu_dev,&versions,1)); > > > + if (0 > ret) > > > + goto free_opp; > > The goto here is wrong If we are here, then the first dev_pm_opp_set_supported_hw() succeeded. And should be deallocated before exit with error. > > > > + > > > + > > > + ret = > PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt", > > > + -1, > > > + NULL, 0)); > > > + > > > + if (0 == ret) > > > + return 0; > > > + > > > +free_opp: > > > + dev_pm_opp_put_supported_hw(opp_temp); > > > > This is not needed because dev_pm_opp_set_supported_hw will free > > memory in case of failure. This call in only needed in case of a > > successful get. > > But this is still required for the case where platform device registration fails. > > -- > viresh From mboxrd@z Thu Jan 1 00:00:00 1970 From: ilialin@codeaurora.org (ilialin at codeaurora.org) Date: Thu, 17 May 2018 10:50:34 +0300 Subject: [PATCH v7 12/14] cpufreq: Add Kryo CPU scaling driver In-Reply-To: <20180516141132.aqjif7d5motmmnlo@vireshk-i7> References: <1526375616-16904-1-git-send-email-ilialin@codeaurora.org> <1526375616-16904-13-git-send-email-ilialin@codeaurora.org> <20180516141132.aqjif7d5motmmnlo@vireshk-i7> Message-ID: <017601d3edb3$c0d96d40$428c47c0$@codeaurora.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org > -----Original Message----- > From: Viresh Kumar > Sent: Wednesday, May 16, 2018 17:12 > To: Amit Kucheria > Cc: Ilia Lin ; Michael Turquette > ; sboyd at kernel.org; Rob Herring > ; Mark Rutland ; nm at ti.com; > lgirdwood at gmail.com; broonie at kernel.org; Andy Gross > ; David Brown ; > catalin.marinas at arm.com; will.deacon at arm.com; Rafael J. Wysocki > ; linux-clk at vger.kernel.org; > devicetree at vger.kernel.org; LKML ; Linux > PM list ; linux-arm-msm at vger.kernel.org; linux- > soc at vger.kernel.org; lakml ; > Rajendra Nayak ; nicolas.dechesne at linaro.org; > celster at codeaurora.org; tfinkel at codeaurora.org > Subject: Re: [PATCH v7 12/14] cpufreq: Add Kryo CPU scaling driver > > On 16-05-18, 16:12, Amit Kucheria wrote: > > > + ret = PTR_ERR_OR_ZERO(opp_temp = > > > + > dev_pm_opp_set_supported_hw(cpu_dev,&versions,1)); > > > + if (0 > ret) > > > > Any particular reason to prefer this over (ret < 0) that is generally > > used? I've seen it used to avoid the == vs. = typos, but not for other > > comparisons. > > > > Suggest sticking to what is commonly used i.e. ret < 0. > > > > > + goto free_opp; > > > + > > > + cpu_dev = get_cpu_device(GOLD_LEAD); > > > > Error check cpu_dev here? > > > > > + ret = PTR_ERR_OR_ZERO(opp_temp = > > > + > dev_pm_opp_set_supported_hw(cpu_dev,&versions,1)); > > > + if (0 > ret) > > > + goto free_opp; > > The goto here is wrong If we are here, then the first dev_pm_opp_set_supported_hw() succeeded. And should be deallocated before exit with error. > > > > + > > > + > > > + ret = > PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt", > > > + -1, > > > + NULL, 0)); > > > + > > > + if (0 == ret) > > > + return 0; > > > + > > > +free_opp: > > > + dev_pm_opp_put_supported_hw(opp_temp); > > > > This is not needed because dev_pm_opp_set_supported_hw will free > > memory in case of failure. This call in only needed in case of a > > successful get. > > But this is still required for the case where platform device registration fails. > > -- > viresh