media: imx7-mipi-csis: Add a check for devm_regulator_get
[ Upstream commit a0219deefe9ee5006a28d48522f76b217d198c51 ] devm_regulator_get may return an error but mipi_csis_phy_init misses a check for it. This may lead to problems when regulator_set_voltage uses the unchecked pointer. This patch adds a check for devm_regulator_get to avoid potential risk. Signed-off-by: Chuhong Yuan <hslester96@gmail.com> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
1a8c277e8d
commit
b4605db4ba
@ -350,6 +350,8 @@ static void mipi_csis_sw_reset(struct csi_state *state)
|
||||
static int mipi_csis_phy_init(struct csi_state *state)
|
||||
{
|
||||
state->mipi_phy_regulator = devm_regulator_get(state->dev, "phy");
|
||||
if (IS_ERR(state->mipi_phy_regulator))
|
||||
return PTR_ERR(state->mipi_phy_regulator);
|
||||
|
||||
return regulator_set_voltage(state->mipi_phy_regulator, 1000000,
|
||||
1000000);
|
||||
@ -966,7 +968,10 @@ static int mipi_csis_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
mipi_csis_phy_init(state);
|
||||
ret = mipi_csis_phy_init(state);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
mipi_csis_phy_reset(state);
|
||||
|
||||
mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user