mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-21 10:01:00 +00:00
i2c: xlr: Fix a resource leak in the error handling path of 'xlr_i2c_probe()'
[ Upstream commit7f98960c04
] 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:75d31c2372
("i2c: xlr: add support for Sigma Designs controller variant") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Wolfram Sang <wsa@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
5b12e19315
commit
01e189372d
1 changed files with 5 additions and 1 deletions
|
@ -431,11 +431,15 @@ static int xlr_i2c_probe(struct platform_device *pdev)
|
||||||
i2c_set_adapdata(&priv->adap, priv);
|
i2c_set_adapdata(&priv->adap, priv);
|
||||||
ret = i2c_add_numbered_adapter(&priv->adap);
|
ret = i2c_add_numbered_adapter(&priv->adap);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
goto err_unprepare_clk;
|
||||||
|
|
||||||
platform_set_drvdata(pdev, priv);
|
platform_set_drvdata(pdev, priv);
|
||||||
dev_info(&priv->adap.dev, "Added I2C Bus.\n");
|
dev_info(&priv->adap.dev, "Added I2C Bus.\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_unprepare_clk:
|
||||||
|
clk_unprepare(clk);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xlr_i2c_remove(struct platform_device *pdev)
|
static int xlr_i2c_remove(struct platform_device *pdev)
|
||||||
|
|
Loading…
Reference in a new issue