Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751670AbdFGKfK (ORCPT ); Wed, 7 Jun 2017 06:35:10 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:54746 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751473AbdFGKfI (ORCPT ); Wed, 7 Jun 2017 06:35:08 -0400 Subject: Re: [PATCH v9 07/10] powerpc/perf: PMU functions for Core IMC and hotplugging From: Anju T Sudhakar To: Thomas Gleixner Cc: mpe@ellerman.id.au, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, ego@linux.vnet.ibm.com, bsingharora@gmail.com, anton@samba.org, sukadev@linux.vnet.ibm.com, mikey@neuling.org, stewart@linux.vnet.ibm.com, dja@axtens.net, eranian@google.com, hemant@linux.vnet.ibm.com, maddy@linux.vnet.ibm.com References: <1496665922-702-1-git-send-email-anju@linux.vnet.ibm.com> <1496665922-702-2-git-send-email-anju@linux.vnet.ibm.com> <692e037d-5367-208f-ac6f-8fd43e1643ba@linux.vnet.ibm.com> Date: Wed, 7 Jun 2017 16:04:57 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <692e037d-5367-208f-ac6f-8fd43e1643ba@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 17060710-0004-0000-0000-000012510CC5 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007188; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000212; SDB=6.00871375; UDB=6.00433389; IPR=6.00651367; BA=6.00005403; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015728; XFM=3.00000015; UTC=2017-06-07 10:35:05 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17060710-0005-0000-0000-00007FA3E2D8 Message-Id: <81a85e3c-2c29-a0d5-3ae6-3e72e1090447@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-06-07_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706070195 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 993 Lines: 40 On Wednesday 07 June 2017 11:14 AM, Anju T Sudhakar wrote: > Hi Thomas, > > On Tuesday 06 June 2017 03:39 PM, Thomas Gleixner wrote: >> On Mon, 5 Jun 2017, Anju T Sudhakar wrote: >>> +static void cleanup_all_core_imc_memory(struct imc_pmu *pmu_ptr) >>> +{ >>> + struct imc_mem_info *ptr = pmu_ptr->mem_info; >>> + >>> + if (!ptr) >>> + return; >> That's pointless. > > No, it is not. We may end up here from imc_mem_init() when the memory > allocation for > pmu_ptr->mem_info fails. So in that case we can just return from here, > and kfree wont be > called with a NULL pointer. > >>> + for (; ptr; ptr++) { >> for (ptr = pmu_ptr->mem_info; ptr; ptr++) { >> >> will do the right thing. Sorry, replied too soon on this. You are right, with this we can remove the if (!ptr) check. thanks. >> >>> + if (ptr->vbase[0] != 0) >>> + free_pages(ptr->vbase[0], 0); >>> + } >> and kfree can be called with a NULL pointer. >> Yes right. Regards, Anju