Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752645AbbH0Bb2 (ORCPT ); Wed, 26 Aug 2015 21:31:28 -0400 Received: from mail-yk0-f177.google.com ([209.85.160.177]:34657 "EHLO mail-yk0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750801AbbH0Bb1 (ORCPT ); Wed, 26 Aug 2015 21:31:27 -0400 MIME-Version: 1.0 In-Reply-To: <20150826131402.GN8784@linux> References: <20150820161402.GA4951@localhost> <20150826124736.GA10956@e104805> <20150826125158.GM8784@linux> <20150826130921.GB10956@e104805> <20150826131402.GN8784@linux> Date: Thu, 27 Aug 2015 07:01:26 +0530 Message-ID: Subject: Re: [PATCH v2] thermal: cpu_cooling: Remove usage of devm functions From: Vaishali Thakkar To: Viresh Kumar Cc: Javi Merino , Zhang Rui , Eduardo Valentin , "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1644 Lines: 52 On Wed, Aug 26, 2015 at 6:44 PM, Viresh Kumar wrote: > On 26-08-15, 14:09, Javi Merino wrote: >> On Wed, Aug 26, 2015 at 01:51:58PM +0100, Viresh Kumar wrote: >> > On 26-08-15, 13:47, Javi Merino wrote: >> > > I missed this because I wasn't CCed :( Thankfully, I'll be in >> > > MAINTAINERS for this soon. >> > >> > Yeah, I need to resend that patch soon :) >> > >> > > > - devm_kfree(&cdev->device, load_cpu); >> > > >> > > This introduces a memory leak. Keep the kfree() here, you can't drop >> > > it. Cheers, >> > > Javi >> > > >> > > > - } >> > > > - >> > > > *power = static_power + dynamic_power; >> > > > return 0; > > So, the change I suggested on V1 removed this as well :) and Vaishali > missed it completely. Yes. I missed the point that kfree was called at 2 places previously. Would you like me to send v3 with changes having just new label with 'goto' at both of these places or you would like to apply v1 of the patch? >> > > > + >> > > > +free: >> > > > + kfree(load_cpu); >> > >> > Wouldn't this make that work ? >> >> Nope, you're not reaching that code path from there. Removing the >> "return 0" would work, but I don't like it, since we would be calling >> kfree() all the time, even when the trace is not enabled. I'd rather >> leave the kfree() where it is. > > Hmm.. > > -- > viresh -- Vaishali -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/