Skip to content

Commit a2537c9

Browse files
Yang Yingliangwsakernel
authored andcommitted
i2c: mt7621: fix missing clk_disable_unprepare() on error in mtk_i2c_probe()
Fix the missing clk_disable_unprepare() before return from mtk_i2c_probe() in the error handling case. Fixes: d04913e ("i2c: mt7621: Add MediaTek MT7621/7628/7688 I2C driver") Signed-off-by: Yang Yingliang <[email protected]> Reviewed-by: Stefan Roese <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 42226c9 commit a2537c9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/i2c/busses/i2c-mt7621.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ static int mtk_i2c_probe(struct platform_device *pdev)
304304

305305
if (i2c->bus_freq == 0) {
306306
dev_warn(i2c->dev, "clock-frequency 0 not supported\n");
307-
return -EINVAL;
307+
ret = -EINVAL;
308+
goto err_disable_clk;
308309
}
309310

310311
adap = &i2c->adap;
@@ -322,10 +323,15 @@ static int mtk_i2c_probe(struct platform_device *pdev)
322323

323324
ret = i2c_add_adapter(adap);
324325
if (ret < 0)
325-
return ret;
326+
goto err_disable_clk;
326327

327328
dev_info(&pdev->dev, "clock %u kHz\n", i2c->bus_freq / 1000);
328329

330+
return 0;
331+
332+
err_disable_clk:
333+
clk_disable_unprepare(i2c->clk);
334+
329335
return ret;
330336
}
331337

0 commit comments

Comments
 (0)