]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
i2c: davinci: Unregister cpufreq notifier on probe failure
authorHaoxiang Li <haoxiang_li2024@163.com>
Wed, 10 Jun 2026 03:05:13 +0000 (11:05 +0800)
committerAndi Shyti <andi.shyti@kernel.org>
Tue, 16 Jun 2026 12:40:00 +0000 (14:40 +0200)
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 <haoxiang_li2024@163.com>
Cc: <stable@vger.kernel.org> # v2.6.36+
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260610030513.2651018-1-haoxiang_li2024@163.com
drivers/i2c/busses/i2c-davinci.c

index 66c23535656b5aec77a54edc9858a912e1d260da..0617f416cb0b55ab04bd750ed7d17b1b753b11d9 100644 (file)
@@ -818,12 +818,14 @@ static int davinci_i2c_probe(struct platform_device *pdev)
        adap->nr = pdev->id;
        r = i2c_add_numbered_adapter(adap);
        if (r)
-               goto err_unuse_clocks;
+               goto err_cpufreq;
 
        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);