Commit
aaabefc79b0ff0018e8e3832169bbe359d0551fc
i2c: viai2c-wmt: Fix clock leak in wmt_i2c_probe()
In wmt_i2c_probe(), i2c->clk is acquired using of_clk_get(). If any
subsequent operation fails or when the module is unloaded, the clock
reference count is never decremented via clk_put(), leading to a
resource leak.
Switch to devm_clk_get() so that the clock is automatically managed
and released.
Fixes: 560746eb79d3 ("i2c: vt8500: Add support for I2C bus on Wondermedia SoCs")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://patch.msgid.link/20260916070631.1965713-1-vulab@iscas.ac.cn
Wentao Liang <vulab@iscas.ac.cn> · 2026-09-16 07:06 UTC · committed by Andi Shyti
1 file changed,
+1
−1
modified drivers/i2c/busses/i2c-viai2c-wmt.c
| @@ -116,7 +116,7 @@ static int wmt_i2c_probe(struct platform_device *pdev) | |||
| 116 | 116 | if (err) | |
| 117 | 117 | return err; | |
| 118 | 118 | ||
| 119 | - | i2c->clk = of_clk_get(np, 0); | |
| 119 | + | i2c->clk = devm_clk_get(&pdev->dev, NULL); | |
| 120 | 120 | if (IS_ERR(i2c->clk)) | |
| 121 | 121 | return dev_err_probe(&pdev->dev, PTR_ERR(i2c->clk), | |
| 122 | 122 | "unable to request clock\n"); | |