Re: [PATCH v2] thermal: cpu_cooling: Remove usage of devm functions
From: Viresh Kumar
Date: Wed Aug 26 2015 - 09:14:13 EST
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.
> > > > +
> > > > +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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/