From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752482AbdEQKEQ (ORCPT ); Wed, 17 May 2017 06:04:16 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:21853 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751348AbdEQKEO (ORCPT ); Wed, 17 May 2017 06:04:14 -0400 Subject: Re: [PATCH 2/2] ARM: davinci: PM: Do not free useful resources in normal path in 'davinci_pm_init' To: Christophe JAILLET , , References: <20170513114020.23668-1-christophe.jaillet@wanadoo.fr> CC: , , From: Sekhar Nori Message-ID: <68b895dc-1bcf-fb59-0e19-e69b2e72f8c1@ti.com> Date: Wed, 17 May 2017 15:33:36 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170513114020.23668-1-christophe.jaillet@wanadoo.fr> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Saturday 13 May 2017 05:10 PM, Christophe JAILLET wrote: > This looks spurious to iounmap resources in the normal path of this init > function. > The 3 ioremap'ed fields of 'pm_config' can be accessed later on in other > functions, so it is likely that we should return 'success' before unrolling > everything. > > Fixes: aa9aa1ec2df6 ("ARM: davinci: PM: rework init, remove platform device") > Signed-off-by: Christophe JAILLET > --- > This patch is just a *guess*. The end of the function looks more like a > error handling code rather than a normal path. The patch is correct. > --- > arch/arm/mach-davinci/pm.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm/mach-davinci/pm.c b/arch/arm/mach-davinci/pm.c > index d282b0783ecf..163d865abbf9 100644 > --- a/arch/arm/mach-davinci/pm.c > +++ b/arch/arm/mach-davinci/pm.c > @@ -161,6 +161,7 @@ int __init davinci_pm_init(void) > davinci_cpu_suspend_sz); > > suspend_set_ops(&davinci_pm_ops); > + return 0; We normally have an empty line before return. I added that while applying. Also, I modified the patch description to be more "sure" in its language. Here is the final description: ARM: davinci: PM: Do not free useful resources in normal path in 'davinci_pm_init' It is wrong to iounmap resources in the normal path of davinci_pm_init() The 3 ioremap'ed fields of 'pm_config' can be accessed later on in other functions, so we should return 'success' instead of unrolling everything. Fixes: aa9aa1ec2df6 ("ARM: davinci: PM: rework init, remove platform device") Signed-off-by: Christophe JAILLET [nsekhar@ti.com: commit message and minor style fixes] Signed-off-by: Sekhar Nori I will let this go through some testing before sending for inclusion in v4.12 kernel. Thanks for catching these. For future, when sending more than one patch, please add a cover letter. And have the patches appear as replies to the cover letter. This happens if you send the patches together with cover letter using git-send-email and have chainreplyto set to false in your .gitconfig Thanks, Sekhar