Re: [PATCH 6.12 469/602] i2c: davinci: Unregister cpufreq notifier on probe failure
Harshit Mogalapalli <[email protected]> Fri, 31 Jul 2026 22:40:53 +0530
| Newsgroups | dev.linux.lists.patches,org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
On 30/07/26 7:44 pm, Greg Kroah-Hartman wrote: > 6.12-stable review patch. If anyone has any objections, please let me know. > > ------------------ > > From: Haoxiang Li <[email protected]> > > [ Upstream commit e43f32816a1b1fe5a86279411626fe3a9be56d45 ] > > davinci_i2c_probe() registers a cpufreq transition notifier before adding > the I2C adapter. If i2c_add_numbered_adapter() fails, the probe error path > releases the device resources without unregistering the notifier. > > Add a dedicated error path to unregister the cpufreq notifier after > i2c_add_numbered_adapter() fails. > > Fixes: 82c0de11b734 ("i2c: davinci: Add cpufreq support") > Signed-off-by: Haoxiang Li <[email protected]> > Cc: <[email protected]> # v2.6.36+ > Reviewed-by: Bartosz Golaszewski <[email protected]> > Signed-off-by: Andi Shyti <[email protected]> > Link: https://lore.kernel.org/r/[email protected] > Signed-off-by: Sasha Levin <[email protected]> > Signed-off-by: Greg Kroah-Hartman <[email protected]> > --- > drivers/i2c/busses/i2c-davinci.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > --- a/drivers/i2c/busses/i2c-davinci.c > +++ b/drivers/i2c/busses/i2c-davinci.c > @@ -864,13 +864,15 @@ static int davinci_i2c_probe(struct plat > adap->nr = pdev->id; > r = i2c_add_numbered_adapter(adap); > if (r) > - goto err_unuse_clocks; > + goto err_cpufreq; > > pm_runtime_mark_last_busy(dev->dev); > pm_runtime_put_autosuspend(dev->dev); > > return 0; > > +err_cpufreq: > + i2c_davinci_cpufreq_deregister(dev); > err_unuse_clocks: > pm_runtime_dont_use_autosuspend(dev->dev); > pm_runtime_put_sync(dev->dev); Hi Greg/Sasha, I ran an AI-assisted backport review and checked this manually. The backport handles the i2c_add_numbered_adapter() failure, but 6.12.y has two additional failure paths after the cpufreq notifier is registered: if (IS_ERR(rinfo->scl_gpiod)) { r = PTR_ERR(rinfo->scl_gpiod); goto err_unuse_clocks; } if (IS_ERR(rinfo->sda_gpiod)) { r = PTR_ERR(rinfo->sda_gpiod); goto err_unuse_clocks; } Both bypass: err_cpufreq: i2c_davinci_cpufreq_deregister(dev); The GPIO recovery code is absent upstream because b04ce6385979 ("i2c: davinci: kill platform data") removed it, but it still exists in 6.12.y. If either lookup fails, probe cleanup frees the device containing the registered notifier while the cpufreq chain retains its address. I think this backport is incomplete; I think route both GPIO failure branches through err_cpufreq: Thanks, harshit > > >