Skip to content

Commit 7f98960

Browse files
tititiou36wsakernel
authored andcommitted
i2c: xlr: Fix a resource leak in the error handling path of 'xlr_i2c_probe()'
A successful 'clk_prepare()' call should be balanced by a corresponding 'clk_unprepare()' call in the error handling path of the probe, as already done in the remove function. More specifically, 'clk_prepare_enable()' is used, but 'clk_disable()' is also already called. So just the unprepare step has still to be done. Update the error handling path accordingly. Fixes: 75d31c2 ("i2c: xlr: add support for Sigma Designs controller variant") Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 5fe058b commit 7f98960

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/i2c/busses/i2c-xlr.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,15 @@ static int xlr_i2c_probe(struct platform_device *pdev)
431431
i2c_set_adapdata(&priv->adap, priv);
432432
ret = i2c_add_numbered_adapter(&priv->adap);
433433
if (ret < 0)
434-
return ret;
434+
goto err_unprepare_clk;
435435

436436
platform_set_drvdata(pdev, priv);
437437
dev_info(&priv->adap.dev, "Added I2C Bus.\n");
438438
return 0;
439+
440+
err_unprepare_clk:
441+
clk_unprepare(clk);
442+
return ret;
439443
}
440444

441445
static int xlr_i2c_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)