提交 bb26f6a7 编写于 作者: C Christophe JAILLET 提交者: Zheng Zengkai

media: cxd2880-spi: Fix an error handling path

stable inclusion
from stable-5.10.65
commit 38235f195de92b172224eedca0e2ac8bdf2c8c6d
bugzilla: 182361 https://gitee.com/openeuler/kernel/issues/I4EH3U

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=38235f195de92b172224eedca0e2ac8bdf2c8c6d

--------------------------------

[ Upstream commit dcb01458 ]

If an error occurs after a successful 'regulator_enable()' call,
'regulator_disable()' must be called.

Fix the error handling path of the probe accordingly.

Fixes: cb496cd4 ("media: cxd2880-spi: Add optional vcc regulator")
Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: NSean Young <sean@mess.org>
Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 9e9286bb
...@@ -524,13 +524,13 @@ cxd2880_spi_probe(struct spi_device *spi) ...@@ -524,13 +524,13 @@ cxd2880_spi_probe(struct spi_device *spi)
if (IS_ERR(dvb_spi->vcc_supply)) { if (IS_ERR(dvb_spi->vcc_supply)) {
if (PTR_ERR(dvb_spi->vcc_supply) == -EPROBE_DEFER) { if (PTR_ERR(dvb_spi->vcc_supply) == -EPROBE_DEFER) {
ret = -EPROBE_DEFER; ret = -EPROBE_DEFER;
goto fail_adapter; goto fail_regulator;
} }
dvb_spi->vcc_supply = NULL; dvb_spi->vcc_supply = NULL;
} else { } else {
ret = regulator_enable(dvb_spi->vcc_supply); ret = regulator_enable(dvb_spi->vcc_supply);
if (ret) if (ret)
goto fail_adapter; goto fail_regulator;
} }
dvb_spi->spi = spi; dvb_spi->spi = spi;
...@@ -618,6 +618,9 @@ cxd2880_spi_probe(struct spi_device *spi) ...@@ -618,6 +618,9 @@ cxd2880_spi_probe(struct spi_device *spi)
fail_attach: fail_attach:
dvb_unregister_adapter(&dvb_spi->adapter); dvb_unregister_adapter(&dvb_spi->adapter);
fail_adapter: fail_adapter:
if (!dvb_spi->vcc_supply)
regulator_disable(dvb_spi->vcc_supply);
fail_regulator:
kfree(dvb_spi); kfree(dvb_spi);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册