Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1213839

Re: [PATCH v2] thermal: cpu_cooling: Remove usage of devm functions

From Javi Merino <javi.merino@arm.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] thermal: cpu_cooling: Remove usage of devm functions
Date 2015-08-26 15:10 +0200
Message-ID <q1ICK-6BL-11@gated-at.bofh.it> (permalink)
References <pZAJk-1B8-9@gated-at.bofh.it> <q1Ijp-602-31@gated-at.bofh.it> <q1It5-6bl-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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;
> > > +
> > > +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.

Cheers,
Javi
--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] thermal: cpu_cooling: Remove usage of devm functions Vaishali Thakkar <vthakkar1994@gmail.com> - 2015-08-20 18:20 +0200
  Re: [PATCH v2] thermal: cpu_cooling: Remove usage of devm functions Javi Merino <javi.merino@arm.com> - 2015-08-26 14:50 +0200
    Re: [PATCH v2] thermal: cpu_cooling: Remove usage of devm functions Viresh Kumar <viresh.kumar@linaro.org> - 2015-08-26 15:00 +0200
      Re: [PATCH v2] thermal: cpu_cooling: Remove usage of devm functions Javi Merino <javi.merino@arm.com> - 2015-08-26 15:10 +0200
        Re: [PATCH v2] thermal: cpu_cooling: Remove usage of devm functions Viresh Kumar <viresh.kumar@linaro.org> - 2015-08-26 15:20 +0200
          Re: [PATCH v2] thermal: cpu_cooling: Remove usage of devm functions Vaishali Thakkar <vthakkar1994@gmail.com> - 2015-08-27 03:40 +0200
            Re: [PATCH v2] thermal: cpu_cooling: Remove usage of devm functions Javi Merino <javi.merino@arm.com> - 2015-08-27 11:10 +0200

csiph-web