Re: [PATCH V4 1/3] thermal: core: call put_device() only after device_register() fails

From: Rafael J. Wysocki
Date: Thu Jan 19 2023 - 15:09:29 EST


On Thu, Jan 19, 2023 at 6:16 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
>
> On 18-01-23, 20:58, Rafael J. Wysocki wrote:
> > On Wed, Jan 18, 2023 at 9:38 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
> > >
> > > put_device() shouldn't be called before a prior call to
> > > device_register(). __thermal_cooling_device_register() doesn't follow
> > > that properly and needs fixing. Also
> > > thermal_cooling_device_destroy_sysfs() is getting called unnecessarily
> > > on few error paths.
> > >
> > > Fix all this by placing the calls at the right place.
> > >
> > > Based on initial work done by Caleb Connolly.
> > >
> > > Fixes: 4748f9687caa ("thermal: core: fix some possible name leaks in error paths")
> > > Fixes: c408b3d1d9bb ("thermal: Validate new state in cur_state_store()")
> > > Reported-by: Caleb Connolly <caleb.connolly@xxxxxxxxxx>
> > > Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> >
> > OK, so I think that this patch is needed for 6.2 and the other two may
> > be queued up for later (they do depend on this one, though, of
> > course). Is my understanding correct?
>
> Right.

OK, applied as 6.2-rc material and I'll get to the other two when this goes in.